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 07-26-2013, 09:33 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Irritating issue unsetting flags

I'm in the process of coding character slots which I have done perfectly fine before without this issue. I'm attempting to clear all the flags from the player when switching from one slot to another and this method has worked perfectly fine before for me. What I'm doing is the following in its simplest form

PHP Code:
public function clearFlags(){
  for (
temp.clientr.getdynamicvarnames()) clientr.(@ temp.i) = null;

What is happening is that anything that has been added to the players flags in the current session can be echo'd to RC if i were to do echo(temp.i); however anything that wasnt removed is now hanging in the flags indefinately. Sure I could just do something along the lines of clientr.mud_item = null; however this worked previously and it just randomly stopped working so I don't think I should have to hack a way around it. I'm positive that it's within the scope of the player. I can echo the clientr variable to rc just not unset it with that line of code anymore. It's really strange. I've heard of people having issues with clientr variables in the past that randomly stopped working so I'm under the assumption that that is what is going on here but if anyone has any advice on fixing it please share ye wisdom. I've attempted restarting the NPC Server and reconnecting to RC but that did not fix it.
Reply With Quote
  #2  
Old 07-26-2013, 09:43 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Have you tried:

PHP Code:
clientr.clearvars(); 
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #3  
Old 07-26-2013, 09:50 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Yes, that's actually what i was originally using. I started using the above code for debugging purposes so I could see what flags it could see and what flags it couldn't.

Edit: Just found this recent post by Dusty. Sounds like a similar issue except reconnecting does not resolve it
Quote:
Originally Posted by DustyPorViva View Post
Today I logged on and clientr.vars were persisting after being cleared, and despite being removed from flags via clientr-rc, reverted back to older versions upon being modified. The only way to truly clear them was via script. Then getstringkeys() was returning clientr flags that were non-existent.

What fixed these strings of problems? Relogging, apparently. This is the kind of BS that absolutely drives me mad when I try to get anything done scripting.
Reply With Quote
  #4  
Old 07-26-2013, 09:58 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
I just tried this on my pc:# account,

PHP Code:
function onCreated() {
  
temp.pl findplayer("pc:10610964");
  
temp.pl.clientr.testclear "abcdefg";
  echo(
"Before: " temp.pl.clientr.testclear);
  echo(
"Size Before: " temp.pl.clientr.getDynamicVarNames().size());
  
temp.pl.clientr.clearVars();
  echo(
"After: " temp.pl.clientr.testclear);
  echo(
"Size After: " temp.pl.clientr.getDynamicVarNames().size()); 

Quote:
Originally Posted by Output
Before: abcdefg
Size Before: 9
After:
Size After: 0
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #5  
Old 07-26-2013, 10:08 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
these are the current flags with everything else commented out on the control-npc as to not interfere.

Before:
clientr.isStaff=1
clientr.mud_charslot=1,Novice,player,1,""


After:
Size Before: 2
After:
Size After: 0

clientr.isStaff=1
clientr.mud_charslot=1,Novice,player,1,""
clientr.testclear=abcdefg
Reply With Quote
  #6  
Old 07-26-2013, 10:09 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Cubical View Post
Edit: Just found this recent post by Dusty. Sounds like a similar issue except reconnecting does not resolve it
According to Stefan, this had to do with subarrays:

Wrong:
PHP Code:
clientr.test = {{"bleh",1},{"foo",1"}};
clientr.test[0][1]++; 
Fine:
PHP Code:
clientr.test = {{"bleh",1},{"foo",1"}};
temp.arr = clientr.test[0];
temp.arr[1]++;
clientr.test[0] = temp.arr; 
Apparently altering subarray values in clientr.strings does not trigger the server to update the information on its side. Gscript treats it like a regular object so the script is keeping track of the changes, but it never saves to the server.

This doesn't sound like what's happening to you, but I figured I'd update on that little issue.

Something similar may be happening with getstringkeys. Maybe Jerret will see this though since I know he's used clientr and getstringkeys for the Easter event on iClassic.
Reply With Quote
  #7  
Old 07-26-2013, 10:20 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Quote:
Originally Posted by Cubical View Post
these are the current flags with everything else commented out on the control-npc as to not interfere.

Before:
clientr.isStaff=1
clientr.mud_charslot=1,Novice,player,1,""


After:
Size Before: 2
After:
Size After: 0

clientr.isStaff=1
clientr.mud_charslot=1,Novice,player,1,""
clientr.testclear=abcdefg
Quote:
Originally Posted by DustyPorViva View Post
...
This is the kind of BS that absolutely drives me mad when I try to get anything done scripting.
Re-quoting this as my response.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #8  
Old 07-26-2013, 10:27 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
I guess it's back to redditing while waiting for more responses
Reply With Quote
  #9  
Old 07-26-2013, 10:42 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I just do:

clientr.(@flag) = "";

On Zodiac we have a list of variables that are specific to characters. So for items we do:

PHP Code:
for (temp.itemgetstringkeys("clientr.item_")) {
  
clientr.("item_" @temp.item) = "";
}
for (
temp.statgetstringkeys("clientr.stat.")) {
  
clientr.stat.(@temp.stat) = "";

__________________
Quote:
Reply With Quote
  #10  
Old 07-26-2013, 10:51 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by fowlplay4 View Post
I just do:

clientr.(@flag) = "";

On Zodiac we have a list of variables that are specific to characters. So for items we do:

PHP Code:
for (temp.itemgetstringkeys("clientr.item_")) {
  
clientr.("item_" @temp.item) = "";
}
for (
temp.statgetstringkeys("clientr.stat.")) {
  
clientr.stat.(@temp.stat) = "";

Just tried using the following

PHP Code:
for(temp.getstringkeys("clientr.mud_")){
  
clientr.("mud_" temp.i) = "";

They are still not clearing for some reason.

Edit: Just to reiterate I cannot echo the clientr vars that are from a previous session. I can echo anything from the current session im in but anything outside of that does not return anything. It's like they have been removed but they stay in the flags still.
Reply With Quote
  #11  
Old 07-26-2013, 11:31 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
If anyone wants me to give them access to take a look just let me know and I'll add you. I'm stumped on what to try next.

Edit: I've added all 3 of you to server options with rw WEAPONS/accountname

Last edited by Cubical; 07-26-2013 at 11:43 PM..
Reply With Quote
  #12  
Old 07-27-2013, 01:29 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Just an update, it appears to be removing anything without an underscore in it now which is strange. It wont even recognize anything with an underscore. I haven't tried coding anything really since GS3 was enabled could it possible be a conflict with that even though I'm not currently using it?
Reply With Quote
  #13  
Old 07-27-2013, 01:40 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva


Welcome to Graal!
Where everything is made up and the syntax don't matter!
Reply With Quote
  #14  
Old 07-27-2013, 01:49 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Quote:
Originally Posted by DustyPorViva View Post


Welcome to Graal!
Where everything is made up and the syntax don't matter!
^

maybe try doing two separate checks for flags with and without an underscore?
Reply With Quote
  #15  
Old 07-27-2013, 02:01 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by devilsknite1 View Post
^

maybe try doing two separate checks for flags with and without an underscore?
I'm just going to roll with it and not use underscores since normally if I was programming in any other language I wouldn't it for anything but constants. I'm still very curious on how to resolve it since it was working last time I was coding.
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 09:35 AM.


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