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
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Sat Feb 16, 2002 2:35 am   

alias is running wierd and I can't figure out why
 
I have this alias which I just made: (this is just the part it runs)

tempstr = ""
#LOOP [%numparam( ) - 1] {
tempstr2 = %concat( @tempstr, %param( %i), ";#WAIT;#TEMP {Travelto: Destination reached!}{")
tempstr = @tempstr2
}
tempstr2 = %concat( @tempstr, %param( %numparam( )))
tempstr = @tempstr2
#LOOP [%numparam( ) - 1] {
tempstr2 = %concat( @tempstr, "}")
tempstr = @tempstr2
}
#EXECUTE @tempstr

The idea is that when i type in: r(the name of the alias) 1 2 3 4, it will execute:

1
#TEMP {Travelto: Destination reached!} {
2
#WAIT
#TEMP {Travelto: Destination reached!} {
3
#WAIT
#TEMP {Travelto: Destination reached!} {4}
}
}
It ends up sending:
4 1 2 3 4

I don't know if its a simple syntax error and I'm not catching it or if it's something else
Reply with quote
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Sat Feb 16, 2002 2:57 am   
 
I figured out that the " 1 2 3 4" at the end is just that i didn't flag the variables are used, but I still wonder what its doing.

What It should do, is send "1" and then wait for a "Travelto: Destination reached!", then send "2", then wait for another "Travelto: Destination reached!", then send a "3" ...

By the way, tempstr == "4 1 2 3 4" when the alias finishes, so nothing else is happening.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Feb 17, 2002 3:59 pm   
 
Why do you want to do this? This is probably not the best approach.

Generally speaking, ALL special characters (such as {, ;, and #) that are not intended for IMMEDIATE evaluation should be preceded by a ~.

Is the text "Travelto: Destination reached!" something your MUD sends to you or something you want to send to yourself?

It's much easier to write a straightforward script than to write a script which writes another script which writes a third script and then a fourth, and a fifth, and on to however many parameters you have. It's not surprising you're having difficulty.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Sun Feb 17, 2002 6:45 pm   
 
The reason I want to do this is that my MUD has a special thing called a travelto which you can "travelto" another city (You can only go to the nearst citys, so you have to do multiple ones to get from say greyhavens to rivendell) to have it automatically take you there (this only works from certain places) and what I'm trying to do is send multiple travelto commands without interrupting the first (If you interrupt it you stop in the middle of nowhere) and the way that works, is to send one command, and then wait until the MUD is finished ("Travelto: Destination reached!") and send another command so that I can travelto from any place to any place by going through the ones in between (i would replace "1", "2",... with the travelto commands that i want it to send.)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Feb 17, 2002 7:15 pm   
 
#VAR TravelQueue {}
#AL Travel {
#IF (@TravelQueue!="") {
#ECHO Travelling, %numitems(@TravelQueue) hops remaining.
} {
#IF (%numparams) {
TravelQueue=%replace("%-1"," ","|")
travelto %pop(TravelQueue)
}
}
}
#TR {^Travelto: Destination reached!$} {
#IF (@TravelQueue="") {
#ECHO Final destination achieved. Thank you travelling the friendly AliasExpress
} {
travelto %pop(TravelQueue)
}
}

I don't remember what version %pop was introduced, so check your help file and speak up if it isn't there.
Reply with quote
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Sun Feb 17, 2002 11:01 pm   
 
right now I'm using 6.16 and %pop isn't there, is there any other way to do it?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Feb 18, 2002 12:55 am   
 
This:
travelto %item(@TravelQueue, 1)
#DELNITEM TravelQueue 1

should replace:
travelto %pop(TravelQueue)

Kjata
Reply with quote
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Mon Feb 18, 2002 7:22 am   
 
Thanks Kjata! it works great!
Reply with quote
tejing
Wanderer


Joined: 21 Dec 2001
Posts: 59
Location: USA

PostPosted: Thu Feb 21, 2002 10:23 pm   
 
hmm...i just noticed that when i was using the script with the automapper on, the automapper does not follow the movements, what should i do? i tried a couple of ways of putting a ">" before it and they don't work. How can I make the automapper follow the movements?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Feb 22, 2002 12:44 am   
 
The mapper won't follow because it does not know where you are going. When you are in a room, and you send north to the MUD, the mapper sees this and moves your position in the map to the room north of where you are. When you use travelto, zMUD doesn't know that that command will move you to another room and ignores it.

You can do one of two in this case:
  • If you know the room where you will arrive after using travelto, you can use the #TELEPORT command to tell the mapper in what room you are supposed to be now.

  • You can use the #FIND command to have zMUD take a look at the current room and try to find it in your map. This, however, can be slow with larger maps.


  • Kjata
    Reply with quote
    tejing
    Wanderer


    Joined: 21 Dec 2001
    Posts: 59
    Location: USA

    PostPosted: Fri Feb 22, 2002 12:48 am   
     
    I actually have setup "Other" exits between the different places you can use a "travelto", so the automapper should detect it

    at least it always used to when i just typed "travelto (whatever)"
    Reply with quote
    tejing
    Wanderer


    Joined: 21 Dec 2001
    Posts: 59
    Location: USA

    PostPosted: Fri Feb 22, 2002 12:48 am   
     
    oh and also, i can't test anything untill i get my map working again anyway. (check out my other post "wierd automapper error")
    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