persistent variables

I used to play graal a lot back before it went pay to play and I recently re-discovered graal reborn so I’m working on making my own server.

I used to do a little bit of scripting but one thing I always had trouble with was persisting states.

So, for example, I have a “system” like weapon that I want to attach to the player when they enter the server and I want it to stick with them.

Now, this weapon will evolve and change over time as the player does quests and whatnot. So, how do I store the changing states of this weapon?

i.e.

if (eventQuestComplete) {
// user just finished a quest so make this weapon’s text different
this.weaponText = “upgrade!”;
}

But, will this player’s weapon’s “this.weaponRange” persist if the player leaves the server and then returns? What if I do a server reboot/restart?

I’ve messed around a bit with save[x], setstring, and setplayerprop. But I’m not sure which (if any) of those is right or what the proper use of them is.

setstring would be the best way to do that.

P.S. use client strings

What does that mean? “use client strings”?

So if I do:

setstring this.myVariable, “hello goodbye”;

then even after the user leaves the server, I reboot the server and bring gserver back up online, the user comes BACK into the server and does something that accesses this.myVariable for the npc it will still have the value “hello goodbye”?!

For some reason I remembered persisting data in graal being more annoying than that.

Awesome

setrstring client.clientString,My name is #n;

setplayerprop #c,#s(client.clientString); will make the player’s chat be “My name is (player’s nick when the string was set)”

the data will still be there after the server is re-started/ after the client disconnects from the server.

accessing and sometimes writing certain things to the strings can be a little tricky

cool, thanks. Also, thanks for the quick reply. This community has really grown since I last came here.

Feel free to ask any more questions on here.