Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Gage
Beginner


Joined: 07 Jan 2003
Posts: 23

PostPosted: Sat Sep 04, 2004 1:09 am   

%arrget not working...
 
Why will this not work?

#SH %arrget( tickedoffmonster, 3)
Where tickedoffmonster is a predefined array of strings.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sat Sep 04, 2004 1:45 am   
 
What happens when you try the following?

#SHOW %arrhigh(tickedoffmonster)
Reply with quote
Gage
Beginner


Joined: 07 Jan 2003
Posts: 23

PostPosted: Sat Sep 04, 2004 2:42 am   
 
#SH %random( 1, %numitems( @tickedoffmonster))
#SH %arrget( %array( tickedoffmonster), 3)
#SHOW %arrhigh( tickedoffmonster)
#SHOWARR @tickedoffmonster

1. Works correctly
2. Nothing
3. Nothing
4. @tickedoffmonster not an array

Now tickedoffmonster is simply a var that has already been setup. It is not defined in the trigger..

Thanks for the help
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Sep 04, 2004 9:02 pm   
 
Your variable probably isn't an array. You didn't think we needed to see it, so there's no way to be sure, but if it was an array then %arrhigh should have given you a number. Unlike you, I've provided an actual example of the variable I used for testing, which is an array.

You also made several mistakes in your use of the array functions and commands.

#VAR tickedoffmonster {%array( rabbit, squirrel, deer, snake, fox)}

#SH %random( 1, %numitems( @tickedoffmonster))
1
#SH %numitems( @tickedoffmonster)
1

#SH %arrget( %array( tickedoffmonster), 3)
Blank line
#SH %arrget( tickedoffmonster, 3)
snake

#SHOW %arrhigh( tickedoffmonster)
4

#SHOWARR @tickedoffmonster
@tickedoffmonster not an array
#SHOWARR tickedoffmonster
Array tickedoffmonster = 0:"rabbit", 1:"squirrel", 2:"deer", 3:"snake", 4:"fox"
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
Gage
Beginner


Joined: 07 Jan 2003
Posts: 23

PostPosted: Sun Sep 05, 2004 1:00 am   
 
Yes, those were probally messed up since I tried many things to make it work properly.

The problem was the varaible was defined as a string list rather then an array. Although though the GUI made it look like an array.

Is there a way through the GUI to make sure an array is defined rather then a string list or you just need to enter it through the command line?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 05, 2004 4:56 am   
 
Arrays are meant to be created/assigned only with the variable command.
zMUD helpfiles wrote:
array

Syntax: %array(values)

return an array filled with values. Only the #VAR command can store an array.

No provision is made for making arrays through the Settings Editor. They must be made through the command line or scripts which use the #VAR command.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net