Graal Forums

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

Cubical 03-16-2010 07:28 AM

clientr. getdynamicvarnames()
 
Is there an alternative to using temp.i = clientr.getdynamicvarnames(); because I can't seem to get it to work or even know if it does work.

I have a bunch of clientr vars like this
NPC Code:

clientr.blah.subvar = {array};
clientr.blah.subvar2 = {array};
clientr.blah.subvar3 = {array};



Any suggestions on what to do?

fowlplay4 03-16-2010 07:32 AM

I use getstringkeys personally.

PHP Code:

for (temp.itemgetstringkeys("clientr.item.")) {
  
temp.itemvarname "clientr.item." temp.item;


On Zodiac our item values are stored in variables: clientr.item-Itemname so the function ends up looking like: getstringkeys("clientr.item-"); so it's not limited by dot notation in that sense.

Cubical 03-16-2010 11:08 AM

Here's another question because I don't want to spam up the forums for something that is dumb.
I currently have this in a for loop that I know works;
PHP Code:

this.sectionarray "weapons","blah";
if (
clientr.item.(@temp.itemarray[temp.i])[0in this.sectionarray){
  
//allow 
  
player.chat "yay i'm in";
} else 
player.chat "/faceroll keyboard"

I know the clientr. and this.sectionarray are working properly but for some reason it just doesn want to work.


I have also tried this with no more luck than I had with the previous one. this isn't exactly how it looks but it shows more of what i'm doing and how i'm acquiring the variables in case anyone was wondering.
PHP Code:

temp.itemarray getstringkeys("clientr.item.");
this.sectionarray "weapons","";
for (
temp.0temp.temp.itemarray.size();temp.i++){
temp.itemcheck clientr.item.(@ temp.itemarray[temp.i])[0];
  if (
temp.itemcheck in this.sectionarray){
    
player.chat "omg finally";
  }  else return -
1;


edit2: 3 hours of messing around with this and still nothing ;[, it's probably something stupid.

Cubical 03-16-2010 02:29 PM

wouldn't let me delete the post but I figured it out, I did ietm instead of item on something else ;[

salesman 03-16-2010 03:25 PM

Quote:

Originally Posted by Cubical (Post 1562866)
Is there an alternative to using temp.i = clientr.getdynamicvarnames(); because I can't seem to get it to work or even know if it does work.

I have a bunch of clientr vars like this
NPC Code:

clientr.blah.subvar = {array};
clientr.blah.subvar2 = {array};
clientr.blah.subvar3 = {array};



Any suggestions on what to do?

You want to get the variables of the clientr variable, "blah". Here's an example of what I mean:

PHP Code:

function test() {
  
this.blah.subvar = {1,2,3};
  
this.blah.subvar2 = {4,5,6};
  
this.blah.subvar3 = {7,8,9};

  
temp.blahVars this.blah.getDynamicVarNames();
  echo(
temp.blahVars); // echoes "subvar,subvar2,subvar3"
  
  // How this may be beneficial:
  
echo(this.hasVar("subvar2")); // echoes 1
  
echo(this.hasVar("subvar7")); // echoes 0

  // or
  
for (temp.foo temp.blahVars) {
    echo(
"Foo " temp.foo ": " this.blah.(@ temp.foo));
  }
  
/* 
     echoes:
     Foo subvar: 1,2,3
     Foo subvar2: 4,5,6
     Foo subvar3: 7,8,9
  */
}

function 
hasVar(foo) {
  
temp.blahVars this.blah.getDynamicVarNames();
  
  return (
temp.foo in temp.blahVars);


Let me know if this doesn't make sense


All times are GMT +2. The time now is 08:25 AM.

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