Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Server-Wide Strings (HELP ME) (https://forums.graalonline.com/forums/showthread.php?t=5183)

LilNiglet 06-19-2001 11:18 PM

Server-Wide Strings (HELP ME)
 
Ok, this is kinda a n00b question, but here goes...
how do initalize a server-wide string, and would it work offline?

Marco2002 06-19-2001 11:59 PM

easy:
setstring server.<stringname>,string;
and yes,it works offline

T-Squad 06-20-2001 12:00 AM

grrrrr

LilNiglet 06-20-2001 12: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 12: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 12:31 AM

message #v(server.string);

you used #s, but use #v

vergil 06-20-2001 01:25 AM

yeah message() is the exact same as setcharprop
its just the equivalent in function like
NPC Code:
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
NPC Code:
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 01:34 AM

Quote:

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 01: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 01:49 AM

Quote:

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 01: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 03:11 AM

Ow... my head... can someone just post the script?

vergil 06-20-2001 03:18 AM

...thats exactly why i dislike this forum
half the topics are GIV MI DIS PLZ BYE

LilNiglet 06-20-2001 03:22 AM

oh well, without some help we would never learn, now would we????

vergil 06-20-2001 03:33 AM

"helping" isnt saying 'here' and posting the script for you to copy and paste

LilNiglet 06-20-2001 08: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 09:10 AM

Radio Script
 
I have never made an NPC like this but ill give it a shot:

this would be for like a DJ Booth:
NPC Code:

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



this would be for all of the other radios:
NPC Code:

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 09: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 12: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 01: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 01:27 AM

hehehe... that was kool
OK I HAVE DIS BUT WHAR IS MA ODER SKRIPT? I NED TI NWO!

CrazedMerlin 06-22-2001 01:47 AM

*confused* :confused:


All times are GMT +2. The time now is 08:06 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.