|
Quit Wanderer
Joined: 19 Jul 2008 Posts: 59
|
Posted: 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 |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Sun Aug 15, 2010 2:22 am |
Putting:
:%item(%names, 1):
in front of the command should be a good workaround |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Quit Wanderer
Joined: 19 Jul 2008 Posts: 59
|
Posted: Sun Aug 15, 2010 2:51 pm |
thanks
got it to work with the #WALK %i only. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: 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} |
|
|
|
|
|
|