|
Trenca Newbie
Joined: 06 May 2012 Posts: 1
|
Posted: Sun May 06, 2012 7:58 pm
Little help with sailing script |
Ok I've been trying to port a mushclient plugin for the mud I play. And so far I'm like this
Code: |
<alias name="sail" language="Lua" id="34">
<value>island = {
["island"] = "230,45",
["another"] = "-273,321"
}
list = {
[0] = "Another Island: another",
[1] = "Some Island: island"
}
if opt == "to" then
send("sail to ".. island.destination)
elseif opt == "list" then
for dest in ipairs(list) do
print(dest)
end
else
print("To see a list of Destinations type: \"sail list\"\nTo travel to a destination type: \"sail to 'destination'\"")
end
</value>
<arglist>$opt $destination</arglist>
</alias>
|
I shortened both tables to just hold to values just to make it easier to understand.
What I'm trying to do here is this behaviour:
command: sail to island sends to mud
command sail list outputs in window
Code: |
Another Island: another
Some Island: island
|
and command sail displays a little help message
Code: |
To see a list of Destinations type: "sail list"
To travel to a destination type: "sail to 'destination' "
|
If anyone can help to make it work. I wonder if i'm calling opt and destination as parameters valid for this alias or not. |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon May 07, 2012 2:52 am |
The arguments aren't expanded into local variables automatically in Lua, you need to use zs.param(opt) and zs.param(destination). Would be nice if it was automatic though, *wink wink*.
|
|
|
|
|
|
|
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
|
|