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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Quit
Wanderer


Joined: 19 Jul 2008
Posts: 59

PostPosted: Sat Aug 14, 2010 11:03 pm   

Help with #FORALL
 
hi

I can't get this to work.

roomnumber="1100|1101|1108|1109"

#FORALL @roomnumber {#WIN rooms <send '#WALK %item(@roomnumber,%i)'>%item(@roomnumber,%i)</send>}

It does nothing at all.

But if I do
#FORALL @roomnumber {#WIN rooms <send '#WALK %item(@roomnumber,1)'>%item(@roomnumber,1)</send>}
it type:
1100
1100
1100
1100

Think its the <send> that dosent like the %i but don't know what else to do
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Aug 14, 2010 11:23 pm   
 
The reason it doesn't work is because you're trying to do %i from a #FORALL with %item on a list with fewer than 1100 items. The correct syntax for %item is %item(@list, number no greater than number of items in @list). However, you can do #WALK %i and it'll work.

%i corresponds to the item the #FORALL is currently on, so when it runs the first time, it sends 1100 as %i, then 1101 as %i, and so forth. When you do #LOOP, however, it corresponds to the current number the #LOOP is on.

Charneus
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Aug 14, 2010 11:36 pm   
 
FYI there's a bug involving the use of #WALK, #TELEPORT, #RECALL, and I believe #LOCATION centered around calling the mapper from a different window. Essentially, that part of the mapper is only visible to the main window itself via natural calls originating from scripts in that main window/package. Even commands like #EXECWIN, which according to Zugg should be getting seen as a scope origination from the main window, won't work if the script containing the #EXECWIN is coming from a different window.

In addition to those four commands, various map functions won't work either for similar reasons.
_________________
EDIT: I didn't like my old signature
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4672
Location: Pensacola, FL, USA

PostPosted: Sun Aug 15, 2010 2:22 am   
 
Putting:

:%item(%names, 1):

in front of the command should be a good workaround
_________________
Discord: Shalimarwildcat
Reply with quote
Quit
Wanderer


Joined: 19 Jul 2008
Posts: 59

PostPosted: Sun Aug 15, 2010 2:51 pm   
 
thanks

got it to work with the #WALK %i only.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Aug 16, 2010 4:32 pm   
 
One problem is here:
Quote:
roomnumber="1100|1101|1108|1109"

That is assigning a STRING value to roomnumber and not a proper string list. To get a string list, you MUST use {} around the value and NOT the " quote. So it should look like this:
Code:
roomnumber={1100|1101|1108|1109}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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