Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Irritating issue unsetting flags (https://forums.graalonline.com/forums/showthread.php?t=134268526)

Cubical 07-26-2013 09:33 PM

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.

BlueMelon 07-26-2013 09:43 PM

Have you tried:

PHP Code:

clientr.clearvars(); 


Cubical 07-26-2013 09:50 PM

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 (Post 1720667)
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.


BlueMelon 07-26-2013 09:58 PM

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


Cubical 07-26-2013 10:08 PM

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

DustyPorViva 07-26-2013 10:09 PM

Quote:

Originally Posted by Cubical (Post 1721098)
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.

BlueMelon 07-26-2013 10:20 PM

Quote:

Originally Posted by Cubical (Post 1721100)
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 (Post 1720667)
...
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.

Cubical 07-26-2013 10:27 PM

I guess it's back to redditing while waiting for more responses

fowlplay4 07-26-2013 10:42 PM

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) = "";



Cubical 07-26-2013 10:51 PM

Quote:

Originally Posted by fowlplay4 (Post 1721106)
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.

Cubical 07-26-2013 11:31 PM

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

Cubical 07-27-2013 01:29 AM

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?

DustyPorViva 07-27-2013 01:40 AM

http://static.tvtropes.org/pmwiki/pu...Drew_Carey.jpg

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

devilsknite1 07-27-2013 01:49 AM

Quote:

Originally Posted by DustyPorViva (Post 1721117)
http://static.tvtropes.org/pmwiki/pu...Drew_Carey.jpg

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?

Cubical 07-27-2013 02:01 AM

Quote:

Originally Posted by devilsknite1 (Post 1721118)
^

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.

Chompy 07-28-2013 11:07 PM

use

PHP Code:

for(temp.getstringkeys("clientr.mud_")){
  
clientr.(@ "mud_" temp.i) = "";


Or just use makevar()

devilsknite1 07-29-2013 06:46 PM

Quote:

Originally Posted by Chompy (Post 1721183)
use

PHP Code:

for(temp.getstringkeys("clientr.mud_")){
  
clientr.(@ "mud_" temp.i) = "";


Or just use makevar()

The first part is what I was suggesting, but as for having to resort to using makevar() there isn't really a reason for it. It should be able to do what it's supposed to the first time without having to make things more complicated (though it would still likely work). :mad:

I recall reading a thread not to long ago in this same section "why do scripters make things to complicated" or something similar. This topic is probably an appropriate answer.

Cubes 07-29-2013 07:04 PM

I identified the issue, clientr flags or any flags that were set prior to GS3 being enabled with an underscore seem to be stuck in attributes and cannot be removed dynamically. it appears the only way to clear them is actually set it to clientr.muditem_1 = ""; i dont know why though

devilsknite1 07-31-2013 09:24 PM

https://images.encyclopediadramatica...d_Facepalm.jpg

Chompy 08-01-2013 11:35 AM

http://forums.graalonline.com/forums...hp?t=134268469


All times are GMT +2. The time now is 02:52 PM.

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