Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Some sort of resetting problem. (https://forums.graalonline.com/forums/showthread.php?t=82988)

The_Kez 12-03-2008 08:24 PM

Some sort of resetting problem.
 
I'm having a problem with my client and clientr variables resetting (or something) when I reconnect. I have a couple examples of this. One is with quests (right now quest progress is held as a client var. Might hold it on the serverside later or just encrypt.) The second is our stat system, player stats determine what sorts of items the character can equip (i.e you can put 10 points in swords and have some swords to choose from to equip). Those stats are held in clientr vars.

Here's a snippet of the quest sytem:

PHP Code:

function onActionClientsidecmd p1 p2 ) {
  switch ( 
cmd ) {
  
  case 
"UpdateQuestProgress":
  for ( 
temp.i=0temp.i<client.quests_all.size(); temp.i++ )
    if ( 
client.quests_all[i][0] == p1 client.quests_all[i][1] += p2;
  break;
  
  }


Quest info is held like..
var = { {"questname",progress},{"questname",progress} };
That's used for when the player does something that affects quest progress, I can tell the system to update the progress. And it works fine, I send some quest progress and it updates it properly and everything. When I reconnect, though, all of the quest progress is lost and the float values of the client vars are set to zero.

This is what happens in the stat system. I'll have, for example, 20 mastery points in swords. I can keep adding to swords and it'll work fine. Then when I reconnect, again, it seems that the vars are reset. Because when I add into swords again, if I add 5 more mastery points into swords I'll end up with 5, instead of 25.

I have a MUD sys with which I can store this sort of stuff, right now I'm only using it to hold item information, but if it came to it I guess I could use that, I just prefer not having to revamp so much. Any ideas?

Tigairius 12-03-2008 08:54 PM

I think it's a bit sloppy to store it all in client/clientr vars. Check your system NPCs and make sure you're not setting your quest information to a string that doesn't yet exist, etc.

The_Kez 12-03-2008 09:46 PM

Well like I said if I have to I don't mind storing it in the MUD sys, it's not a big deal. I do want to know the cause of the problem though so if I need client and clientr vars for something else later, I don't have this problem.

I fixed the stat issue, for some reason if I use clientr.( "dynamic_" @ var ); then it will reset the variable to zero. But if I say makevar ( "clientr.dynamic_" @ var ); then it works just fine and nothing resets. I don't see why that should make a difference?

LoneAngelIbesu 12-03-2008 11:02 PM

Quote:

Originally Posted by The_Kez (Post 1446508)
Well like I said if I have to I don't mind storing it in the MUD sys, it's not a big deal. I do want to know the cause of the problem though so if I need client and clientr vars for something else later, I don't have this problem.

I fixed the stat issue, for some reason if I use clientr.( "dynamic_" @ var ); then it will reset the variable to zero. But if I say makevar ( "clientr.dynamic_" @ var ); then it works just fine and nothing resets. I don't see why that should make a difference?

Because it should be clientr.(@ "dynamic_" @ var); :cool:

cbk1994 12-04-2008 02:07 AM

I agree, it looks pretty messy.

You may want to consider text files or using a database NPC, the former preferred by me.


All times are GMT +2. The time now is 09:18 AM.

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