Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   strings... (https://forums.graalonline.com/forums/showthread.php?t=9037)

zell12 08-07-2001 02:23 AM

strings...
 
can someone show me some basic's of strings... and how to use server flags...

Falcor 08-07-2001 02:59 AM

use a string by setting

setstring string name,content;

so if you want a string named 'bob' to contain the text 'is cool'

setstring bob,is cool;

you can call a string by have #s(stringname)

so well use bob here

message HELLO! BOB #s(bob);

the NPC would say "HELLO! BOB is cool"

Serer flags are things that dont effects the person alone but the whole server. IF you set a server.flag from one lvl . It can be called from another lvl.

zell12 08-07-2001 09:16 PM

Thankz man, im sill i but confused, but ill get the hang of them some day..

ownerofbabylon 08-07-2001 11:15 PM

How is that cofusing. I will try to explain but Falcor did a good job.

Ok here is an example. Say you wanted a door to appear shut if a player enters and is not a certain class. And lets say the classes are god, robot, and plant man (whoever the idiot was who made these)And you only want the god to enter so. When the player chose to be a god you would have it do this:

if(playertouchsme){
set god;
}

then in the level with the door that only should open for gods put

if(playertouchsme){
if(god){
hidelocal;
else
show;
}
}

I think I messed up and it might be if(god=true) but i cant remember off the top of my head. If you use this it prolly wont work without changing a few things I messed up on but thats the basic Idea.

You set a string or flag (which makes it true) then you can use that to decide things in the game.

To set a server flag just put server.god I think. I never really use those so I dont know.

:D

CrazedMerlin 08-08-2001 04:30 AM

Quote:

Originally posted by ownerofbabylon
How is that cofusing. I will try to explain but Falcor did a good job.

Ok here is an example. Say you wanted a door to appear shut if a player enters and is not a certain class. And lets say the classes are god, robot, and plant man (whoever the idiot was who made these)And you only want the god to enter so. When the player chose to be a god you would have it do this:

if(playertouchsme){
set god;
}

then in the level with the door that only should open for gods put

if(playertouchsme){
if(god){
hidelocal;
else
show;
}
}

I think I messed up and it might be if(god=true) but i cant remember off the top of my head. If you use this it prolly wont work without changing a few things I messed up on but thats the basic Idea.

You set a string or flag (which makes it true) then you can use that to decide things in the game.

To set a server flag just put server.god I think. I never really use those so I dont know.

:D

he said strings not flags

strings would be like
if (playerchats&&strequals(#c, )) {
setstring server.chat,#c;
setstring server.player,#n;
}

to display it would be like

if (playerenters) {timeout=.5;}
if (timeout) {
message #s(server.player): #s(server.chat);
timeout=.5;}


so if you say hey and your nick is Merlin
it would say

Merlin: hey

zell12 08-09-2001 12:57 AM

ok, i get it now..... thankz alot

Luigi223 08-09-2001 01:27 AM

this is strings ... i think
 
i think this is a string or something like that ....


if (playertouchsme) {
toweapons Horse Changer;
}
if (firedonhorse) {
setplayerprop #5,#c.gif;}



get on a horse say the name of a gif then fire the weapon and the horse changes to that gif :)

LiquidIce00 08-09-2001 02:52 AM

well a string is diff. then a variable. so dont confuse the 2 ..
a string can hold letters and numbers.
variables just hold numbers .. and they have a limit . if u read the limit u get some crap like E.601 or something .. some error thing ..
a server string is just like a string but it starts with server.
and it saves into the server strings. which can be changed with RC.
here is a few way to use strings.

NPC Code:

if (playertouchsme) {
setstring mystring, hi;
}


that would set a string called mystring and would contain hi

NPC Code:

if (playertouchsme) {
setstring server.mystring, hi;
}


that would set a server string called server.mystring and would contain hi

and so on ..
also learn #s() and #v() and strtofloat() . those are important


All times are GMT +2. The time now is 06:30 PM.

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