[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Mudlet - Mush converting

Mudlet - Mush converting

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Kresslack   (70 posts)  [Biography] bio
Date Thu 21 Jan 2010 11:25 PM (UTC)
Message
Someone gave me this script to convert to Mush, said it was mostly Lua so that it wouldn't be to difficult. I think I understand, just have never done IF before. S1 is variable for one sword, S2 for the second. Trying to get something together that will allow me to be able to quickly set up venom combos on the fly. Any and all help is appreciated. Thanks in advance.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #1 on Thu 21 Jan 2010 11:30 PM (UTC)
Message
Hullos, Kresslack! Good to see you, but it might be helpful if you could post some/all of the code Vadi gave you for everyone else here to reference - either as a link, or pasted directly with [code] tags, please.

As for 'if' statements, that's basic Lua - you might want to look at the online (free) Programming in Lua book if you plan on doing much scripting: http://www.lua.org/pil/

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kresslack   (70 posts)  [Biography] bio
Date Reply #2 on Fri 22 Jan 2010 01:17 AM (UTC)

Amended on Fri 22 Jan 2010 02:56 AM (UTC) by Kresslack

Message
Ah yes, terribly sorry about that. I'm doing about 50 things at once it seems and forgetting things.

http://pastebin.com/m2611f949


  <?xml version="1.0" encoding="UTF-8" ?> 
  <!DOCTYPE MudletPackage (View Source for full doctype...)> 
- <MudletPackage version="1.0">
  <TriggerPackage /> 
- <AliasPackage>
- <AliasGroup isActive="yes" isFolder="yes">
  <name>Offensive</name> 
  <script /> 
  <command /> 
  <regex /> 
- <Alias isActive="yes" isFolder="no">
  <name>envenom</name> 
  <script>-- first sword for alias,name in pairs(venoms) do if (alias == matches[2]) then envenom(s1, name) end if (alias == matches[3]) then envenom(s2, name) end end</script> 
  <command /> 
  <regex>^e(\w{1})(\w{1})$</regex> 
  </Alias>
  </AliasGroup>
  </AliasPackage>
  <ActionPackage /> 
- <ScriptPackage>
- <ScriptGroup isActive="yes" isFolder="yes">
  <name>General</name> 
  <script>------------------------------------------------- -- Put your Lua functions here. -- -- -- -- Note that you can also use external Scripts -- -------------------------------------------------</script> 
  <eventHandlerList /> 
- <Script isActive="yes" isFolder="no">
  <name>SETTINGS</name> 
  <script>s1 = "sword#####" s2 = "sword#####" -- venom mappings venoms = {} venoms.a = "aconite" venoms.c = "curare" venoms.d = "delphinium" venoms.x = "xentio" venoms.k = "kalmia" venoms.g = "gecko" venoms.i = "slike" venoms.t = "epteth" -- arms venoms.s = "epseth" -- legs venoms.v = "vernalius" venoms.g = "digitalis" venoms.m = "monkshood"</script> 
  <eventHandlerList /> 
  </Script>
- <Script isActive="yes" isFolder="no">
  <name>envenom</name> 
  <script>function envenom (rapier, venom) if rapier == nil or venom == nil then return end send ("envenom " .. rapier .. " with " .. venom) end</script> 
  <eventHandlerList /> 
  </Script>
  </ScriptGroup>
  </ScriptPackage>
  </MudletPackage>
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 22 Jan 2010 08:48 PM (UTC)
Message
You seem to have lost the line breaks that must be in the original. Something like:


-- first sword for alias,name in pairs(venoms) do if


must really be:


-- first sword 

for alias,name in pairs(venoms) do 
  if


Kresslack said:

Someone gave me this script to convert to Mush, said it was mostly Lua so that it wouldn't be to difficult. I think I understand, just have never done IF before.


It won't be too hard, but a basic knowledge of Lua would help.

The first thing is, the Mudlet author has used a similar style to MUSHclient, but not identical. For example, something like:


<AliasPackage>
<Alias isActive="yes" isFolder="no">
  <name>envenom</name> 
  <script>-- script here</script> 
  <command /> 
  <regex>^e(\w{1})(\w{1})$</regex> 
  </Alias>
</AliasPackage>


would become, in MUSHclient:


<aliases>
<alias
  enabled="y"
  name="envenom"
  send_to="12"
  match="^e(\w{1})(\w{1})$"
>
  <send>-- script here</send> 
  </alias>
</aliases>


Similar-looking, but as you can see quite a bit different, too.

You would probably want to automate the conversion, and if you aren't familiar with scripting, this could be tedious.

Then there the script itself. Certainly they both use Lua, but it is like trying to convert zMud Lua to MUSHclient (or vice-versa). Lua is the structure, but what "makes things happen" is the functions provided by the client.

For example, in MUSHclient, to send stuff to the MUD you use:


Send ("inventory")


Now in Mudlet it might be:


send ("inventory")

-- or:

output ("inventory")

-- or:

mud:send ("inventory")


Without reading their documentation, I can't say.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kresslack   (70 posts)  [Biography] bio
Date Reply #4 on Fri 22 Jan 2010 09:37 PM (UTC)
Message
I can see what you're talking about such as Active on Mudlet being Enabled on Mush. On the lower part, are these things case sensitive? The Mush one was Send "inventory" and the mudlet was just send "inventory".
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #5 on Fri 22 Jan 2010 09:39 PM (UTC)
Message
In Lua, functions are case-sensitive, yes. Mudlet named their send-ing functions differently, even though it's just a difference in capitalization.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,438 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]