Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-03-2008, 08:24 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
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?
Reply With Quote
  #2  
Old 12-03-2008, 08:54 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
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.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 12-03-2008, 09:46 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
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?
Reply With Quote
  #4  
Old 12-03-2008, 11:02 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by The_Kez View Post
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);
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #5  
Old 12-04-2008, 02:07 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I agree, it looks pretty messy.

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:19 AM.


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