Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-16-2010, 07:28 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
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?
Reply With Quote
  #2  
Old 03-16-2010, 07:32 AM
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 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.
__________________
Quote:
Reply With Quote
  #3  
Old 03-16-2010, 11:08 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
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.

Last edited by Cubical; 03-16-2010 at 02:19 PM.. Reason: Added more detail about my problem
Reply With Quote
  #4  
Old 03-16-2010, 02:29 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
wouldn't let me delete the post but I figured it out, I did ietm instead of item on something else ;[
Reply With Quote
  #5  
Old 03-16-2010, 03:25 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by Cubical View Post
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:12 AM.


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