i recently wrote a caravaning script for imperian...that i adapted from one i found on here
now i wrote one for it going back, but I'm having trouble with firing the actual alias, because im not sure how to define two things in the alias:
alias: ^caravanfrom (.*+)$
local caravanDestination = string.lower(matches[2])
if caravanDestination == {"kadar","ithaqua"} then
caravanList = {"d","se","up","sw","up","s","s","s","w","sw","w","n","sw","sw","sw","w","n","n","n","n","n","ne","n","in","up","n","n","e","up","s","e","end"}
elseif caravanDestination == {"agirni","ithaqua"} then
caravanList = {"s","sw","s","s","sw","w","w","w","nw","n","n","nw","n","nw","nw","nw","w","in","up","n","n","e","up","s","e","end"}
elseif caravanDestination == {"aherindale","ithaqua"} then
caravanList = {"s","out","ne","s","s","s","s","w","sw","e","e","e","nw","w","up","sw","d","ne","d","n","n","n","n","n","n","ne","n","in","up","n","n","e","up","s","e","end"}
elseif caravanDestination == {"pol'pera","ithaqua"} then
caravanList = {"w","s","sw","out","up","nw","e","nw","up","n","d","n","n","nw","n","n","ne","nw","ne","nw","w","nw","nw","ne","nw","n","ne","nw","w","up","sw","d","ne","d","n","n","n","n","n","n","ne","in","up","n","n","e","up","s","e","end"}
end
caravaning = true
echo("***Route Started!***")
send("lead caravan " .. caravanList[1])
for the alias i originally had: ^caravanfrom (.*+) to (.*+)$
it would fire the route started, but it would not start the caravan, even though i have a trigger for it.
any help would be appreciated.
thanks
alias pattern
-
- Posts: 19
- Joined: Mon Aug 02, 2010 4:35 pm
- Location: A deserted Island
Re: alias pattern
1. Your script contains a bunch of Lua syntax errors. That's why it doesn't work.
2. Why would you want to do such a script in the first place? You can simply use the Mudlet mapper to walk you to any room on Imperian without any hassle whatsoever. Use Mudlet-1.2.0-pre6 + the IRE mapper script that you can find in the script section to do the game specific auto walking.
2. Why would you want to do such a script in the first place? You can simply use the Mudlet mapper to walk you to any room on Imperian without any hassle whatsoever. Use Mudlet-1.2.0-pre6 + the IRE mapper script that you can find in the script section to do the game specific auto walking.
Re: alias pattern
The reason is, on Imperian you lead caravans containing commodities from a city to a village and back, but you have to LEAD CARAVAN (Direction) rather than just walk there and back.Heiko wrote:2. Why would you want to do such a script in the first place? You can simply use the Mudlet mapper to walk you to any room on Imperian without any hassle whatsoever. Use Mudlet-1.2.0-pre6 + the IRE mapper script that you can find in the script section to do the game specific auto walking.
OP: Sorry I don't know how to help you, just knew the answer to Heiko's question
-
- Posts: 19
- Joined: Mon Aug 02, 2010 4:35 pm
- Location: A deserted Island
Re: alias pattern
and the code is fine ... its just the alias that doesn't work
and yes you have to LEAD CARAVAN in order for it to work ....
trigger: ^You lead a caravan (.*+)$
echo("Trace: 0")
if caravaning == true then
echo("trace: 1")
table.remove(caravanList,1)
echo("trace: 2")
if caravanList[1] == "end" then
echo("*Route Finished!*")
caravaning = false
echo("trace: 3")
else
send ("lead caravan " .. caravanList[1])
echo("trace: 4")
end
echo("trace: 5")
end
that's the trigger ... i don't know if i have to write two separate ones, as this is the one for going.
and yes you have to LEAD CARAVAN in order for it to work ....
trigger: ^You lead a caravan (.*+)$
echo("Trace: 0")
if caravaning == true then
echo("trace: 1")
table.remove(caravanList,1)
echo("trace: 2")
if caravanList[1] == "end" then
echo("*Route Finished!*")
caravaning = false
echo("trace: 3")
else
send ("lead caravan " .. caravanList[1])
echo("trace: 4")
end
echo("trace: 5")
end
that's the trigger ... i don't know if i have to write two separate ones, as this is the one for going.
Re: alias pattern
1. getPath( fromRoomID, toRoomID ) calculates the path and sets up 2 global tables: speedWalkPath (that contains the room IDs) and speedWalkDir (that contains the walking directions). You simply write a gmcp room event handler that gets called whenever you move to a new room. Your handler checks if you are in caravaning mode and if this is the case then simply calls getPath() and send("lead caravan " .. speedWalkDir[1]). You can use findRoom(roomid or substring of the room name) to find the appropriate room IDs of your destination. The room ID of your current location will be sent via gmcp when you move to a new room.
That's all there is to it. No triggers, no scripts, no complicated aliases - and it'll lead your caravan to anywhere in the MUD without ever getting lost.
2. If you still like to go with your solution which is perfectly fine, of course, then turn on the error view (red ! button in trigger editor on the left) and debug your Lua run time errors - and yes, there's plenty of them in the alias script that you've posted above. Hints: syntax errors in your table defs and more importantly, your caravanList will *never* get defined because all of your ifs eval to false because a string does not equal a table.
That's all there is to it. No triggers, no scripts, no complicated aliases - and it'll lead your caravan to anywhere in the MUD without ever getting lost.
2. If you still like to go with your solution which is perfectly fine, of course, then turn on the error view (red ! button in trigger editor on the left) and debug your Lua run time errors - and yes, there's plenty of them in the alias script that you've posted above. Hints: syntax errors in your table defs and more importantly, your caravanList will *never* get defined because all of your ifs eval to false because a string does not equal a table.
Re: alias pattern
Heiko is correct about your lua errors and the fact that doing this would be easier with getPath function.
At the least, if you continue to use this route, you would need to rewrite your if statements:
You lead a caravan
Hope this helps.
At the least, if you continue to use this route, you would need to rewrite your if statements:
You could also define a table , and search the values for that.
Trigger: (begin of line substring?)
You lead a caravan
Hope this helps.