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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Trenca
Newbie


Joined: 06 May 2012
Posts: 1

PostPosted: 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
Code:
sail to 230,45


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.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: 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*.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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