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
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Oct 09, 2004 9:12 pm   

Forall and variables
 
I am trying to make an alias such that when I input a word, it takes a different variables (already set up, and checked that it is set up) and compare it to a list of other variables (already set up)

#var list {item1|item2|item3|item4}
#var item1Number {5} {_nodef} "Itemnumbers"
#var item2Number {3} {_nodef} "Itemnumbers"
#var item3Number {2} {_nodef} "Itemnumbers"
#var item4Number {4} {_nodef} "Itemnumbers"

#noop I'll leave out the checking if it's there since that works fine
#alias Make {#var %1Number {%2} {_nodef} "Itemnumbers";check %1}
#alias Check {#forall {@list} {#if (@%1Number < @%iNumber) {#add %1number {1}}}

Basically this will add to all the ither "itemnumbers" greater than the one added

I fiddled around and after playing with #say and such.. I found out the thing that isn't parsing will is the @%ibionumber in the #forall in the Check alias. (it's bolded/underlined) I've tried a few things, but can't seem to make that one part parse properly.

If you want to know how I tested I fiddled around using the same list and itemXNumber variables and used a alias

#alias test {#forall {@list} {#say @%1Number;#say @%iNumber}}

with various things around the %i.. %eval.. extra % a ~.. maybe I had it in the wrong combination but not sure what went wrong and why I could not make it function propertly.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Oct 10, 2004 12:06 am   
 
Lets step through this

First Zmud is looking for the function %iNumber so to get around that we need to do this

#SAY @%{1}Number;#SAY @%{i}Number

Second after we fix the first part %i in #FORALL returns the VALUE of item %i in the loop so it is now expanding like this which from the glance over of your code might be what you want.

Item1Number
Item2Number



Also Im not sure exactly what your trying to do cause I didn't fully read it to understand it but maybe this could be better served with a Database Variable?
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sun Oct 10, 2004 12:56 am   
 
That works perfectly thank you.
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