Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Clearing ALL clientr.vars (https://forums.graalonline.com/forums/showthread.php?t=134269082)

sssssssssss 02-08-2014 03:01 AM

Clearing ALL clientr.vars
 
Is there a way to clear all clientr.vars? Without knowing all the clientr.vars set?

If there isn't some sort of "built in" way, how would I go about doing this in script? I don't even know where to start to grab random var names.

I need to wipe characters clean...

Blah64 02-08-2014 06:50 AM

serverside do something like:

NPC Code:
temp.clientrvars = findplayer(player.acccount).clientr.getdynamicvarn  ames();
for (temp.curvar :temp.clientrvars)
findplayer(player.account).clientr.(@temp.curvar) = null;


xAndrewx 02-08-2014 07:57 AM

HTML Code:

temp.pl = findplayer("xAndrewx");
for (temp.var: temp.pl.getstringkeys("clientr."))
  temp.pl.clientr.(@ temp.var) = null;

Is an alternative

sssssssssss 02-08-2014 01:29 PM

Quote:

Originally Posted by Blah64 (Post 1725970)
serverside do something like:

NPC Code:
temp.clientrvars = findplayer(player.acccount).clientr.getdynamicvarn  ames();
for (temp.curvar :temp.clientrvars)
findplayer(player.account).clientr.(@temp.curvar) = null;


This didn't remove any of them. temp.clientrvars is echoing "0";

Quote:

Originally Posted by xAndrewx (Post 1725971)
HTML Code:

temp.pl = findplayer("xAndrewx");
for (temp.var: temp.pl.getstringkeys("clientr."))
  temp.pl.clientr.(@ temp.var) = null;

Is an alternative

This threw these errors:
PHP Code:

Script: Function sssssssssss.getstringkeys not found at line 185 in script of -System/CharCreate
Script
: Function sssssssssss.getstringkeys not found at line 189 in script of -System/CharCreate 


:/

Jakov_the_Jakovasaur 02-08-2014 02:46 PM

getstringkeys() is not a player function

you can however add it into a class which is joined to the player and it will accomplish the same thing -

PHP Code:

/*
    you probably want to add some callstack checks here to ensure that only permitted scripts are calling this function, or otherwise only join this class to the player before you want to reset them
*/
public function resetClientrVars()
  for(
temp.key getstringkeys("this.clientr."))
    
this.clientr.(@ temp.key) = ""


100Zero100 02-08-2014 03:28 PM

Are you attempting to do Blah64's suggestion in an onCreated on the serverside?

He put findplayer(player.account), which is redundant for "player." Either way, if you tried that in the onCreated, where there is no player scope, that would explain why it wouldn't work.

Doing:

PHP Code:

function onCreated() {
 
temp.findPlayer("Restraint").clientr.getDynamicVarNames();
 echo(
t.size());


in a serversided script, I got the echo "90" -- seems right to me.

sssssssssss 02-08-2014 06:56 PM

Ohh goodness.....
I had an extra "c" in player.account....

Blah's way works fine yes.


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

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