PDA

View Full Version : Server-Wide Strings (HELP ME)


LilNiglet
06-20-2001, 12:18 AM
Ok, this is kinda a n00b question, but here goes...
how do initalize a server-wide string, and would it work offline?

Marco2002
06-20-2001, 12:59 AM
easy:
setstring server.<stringname>,string;
and yes,it works offline

T-Squad
06-20-2001, 01:00 AM
grrrrr

LilNiglet
06-20-2001, 01:16 AM
cool... im trying to make a radio station that brodcasts all over the server... thanks man
oh yeah... and to display it would be
setcharprop #c, #s(server.blahblah);
right?

LilNiglet
06-20-2001, 01:21 AM
no cause if u want to display a string u gotta use the setcharprop, i think...
oh yeah... that doesent work...
how do i display a string as a message above the npc like the text box

06-20-2001, 01:31 AM
message #v(server.string);

you used #s, but use #v

vergil
06-20-2001, 02:25 AM
yeah message() is the exact same as setcharprop
its just the equivalent in function like
if (playerenters) {
function sayradiothing() {
setcharprop #c,#s(server.radio);
}
setstring server.radio,blah;
sayradiothing();
}
whereas sayradiothing() is just the exact same as message() so it doesnt matter whether you use message or setcharprop

anyone know how to supply the function definition an argument? i keep getting a syntax error =\
it would be really nice if you were doing lots of lines of messages with the same beginngin like a game show "And the question is..."
so you would be able to redefine message (orwhatevr you want it) as
function gameshowquestion(beginning,end) {
message #v(beginning),#v(end);
}
setstring begin,"And the question is...";
setstring question1,"who is the president of the US?";
gameshowquestion(begin,question1);
setstring question2,"do you like cheese?";
gameshowquestion(begin,question1);

vergil
06-20-2001, 02:34 AM
Originally posted by Kaimetsu
First, functions can't take arguments.

Second, your script wouldn't work.

Third, I bet there are at least some differences between using message and using a raw setcharprop. There always are.

which one? works for me =\

Why shouldnt functions be able to take arguements? what kind of language is this? that's half the reason they're there..

vergil
06-20-2001, 02:40 AM
Kaimetsu it does work, why dont you open up Graal and try it before you jump to conclusions? =\

The only reason I put it inside an event is because i was fooling around obviously you wouldn't want a radio to turn itself on and tune into a station as soon as you entered the room

vergil
06-20-2001, 02:49 AM
Originally posted by Kaimetsu


Me at college. No Graal. Besides, just because it works doesn't mean it's right. Look, you should separate the function definitions.



No, but that's not my point. You should put the function definition separately.

a script being unorganized does not mean it doesnt work as you had put it =\

if youre at college why are you messing around with a game language so inferior compared to others its laughable? why arent you programming with other things? most of these people are under 15.

vergil
06-20-2001, 02:54 AM
it's just an example I'm not mr. perfect when I script Graal NPCs especially when its just to ask/answer a question.

LilNiglet
06-20-2001, 04:11 AM
Ow... my head... can someone just post the script?

vergil
06-20-2001, 04:18 AM
...thats exactly why i dislike this forum
half the topics are GIV MI DIS PLZ BYE

LilNiglet
06-20-2001, 04:22 AM
oh well, without some help we would never learn, now would we????

vergil
06-20-2001, 04:33 AM
"helping" isnt saying 'here' and posting the script for you to copy and paste

LilNiglet
06-20-2001, 09:14 AM
ok fine... just tell me the right way to make a string and to display it on a NPC in another level

Cybnext_Design
06-20-2001, 10:10 AM
I have never made an NPC like this but ill give it a shot:

this would be for like a DJ Booth:

if (playerchats && strequals(#g,DJ)) {
setstring server.radio,#c;
}


this would be for all of the other radios:

if (created) {
timeout=.05;
}

if (timeout) {
setcharprop #c,#s(server.radio);
timeout=.05;
}


Like I said im not sure if this will work.

LilNiglet
06-20-2001, 10:10 PM
hmm... where is the chatstring from the DJ get converted to the server string? oh wait i think i see it...
yah nevermind im just a stupid n00b

CrazedMerlin
06-22-2001, 01:26 AM
Ill help :)
if (weaponfired&&!weaponon) {setplayerprop #c,On.;
set radioon;}
else
if (weaponfired&&weaponon) {setplayerprop #c,Off.;
unset radioon;}
if (radioon&&playerchats(#c, )) {setstring server.radio,#c;
setstring server.radionick,#n;
}


and to display them in another NPC

timeout=0.1;
if (timeout) {message #s(server.radionick)#s(server.radio);
}

LilNiglet
06-22-2001, 02:15 AM
WOW MAN U R KOOL I HAV DIS NOW AND I MA NOT STOOD NOW... OH YAH I NEED DIS KAY? BY

LilNiglet
06-22-2001, 02:27 AM
hehehe... that was kool
OK I HAVE DIS BUT WHAR IS MA ODER SKRIPT? I NED TI NWO!

CrazedMerlin
06-22-2001, 02:47 AM
*confused* :confused: