Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Teach Me Lua Please

Teach Me Lua Please

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


Posted by Ain   (3 posts)  Bio
Date Tue 24 Jun 2008 11:28 PM (UTC)
Message
I have been using mushclient for years. Was glad when you made it freeware. Many people have suggested that i move to their clients. But when I find something I like, I stick with it.

Now I am curious about learning lua.
I can use trigger and Aliases.

basically

alias k *

send
kill %1


and trigger

*You are thirsty.*

send drink barrel but I want to do more.

Though these have work for me since 2000.
I am anxious to learn Lua.

On my mud, people have written scripts for users of their individual clients.

But I see nothing for mush. So I have come straight to the horse, to get a better understanding of coding plus some coding conversions and explanations.


Here is my first question.

Some one made this script to play all of the bard songs possible, just by entering this code somewhere.

simple lil alias for all non avatar bard songs... if you need one

#CLASS {BardSongs}
#ALIAS ssoul {sing 'sanctuary for the soul'}
#ALIAS gwar {sing 'gods of war'}
#ALIAS flames {sing 'flames at midnight'}
#ALIAS cav {sing 'cry of the avatars'}
#ALIAS oghams {sing 'oghams psalm of discipline'}
#ALIAS rina {sing 'rina cruinne'}
#ALIAS bro {sing 'brothers in arms'}
#ALIAS lion {sing 'lion chorus}
#ALIAS bshad {sing 'beyond the shadows'}
#ALIAS hero {sing 'march of the heroes'}
#ALIAS fare {sing 'fare thee well'}
#ALIAS regen {sing 'dreams of the castle'}
#ALIAS dotm {sing 'dance of the many'}
#ALIAS mstar {sing 'hymn of the morning star'}
#ALIAS sacrep {sing 'sacred reprieve'}
#ALIAS hdir {sing 'haunted dirge'}
#ALIAS roc {sing 'reign of confusion'}
#ALIAS wos {sing 'wall of sleep'}
#ALIAS aye {sing 'eye of the beholder'}
#ALIAS sidhe {sing 'call of the sidhe'}
#ALIAS art {sing 'hymn of an artisan'}
#ALIAS luck {sing 'dance of the seven luck gods'}
#CLASS 0


Where would i enter this code on a mushclient 4.19
What changes would I have to made to made it work in Lua.

Top

Posted by Terry   USA  (87 posts)  Bio
Date Reply #1 on Wed 25 Jun 2008 01:39 AM (UTC)
Message
That sure is one tall order ;) If you want to learn Lua, you'd be best reading documentation and tutorials that have already been written. You can find these all over the place, and the best documentations can be found at lua.org.
As for your script. What you wrote isn't really compatible with MUSHclient, as far as I can see. You -could- however make a plugin for it.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, June 24, 2008, 9:32 PM -->
<!-- MuClient version 4.29 -->
<!-- Plugin "songs" generated by Plugin Wizard -->

<muclient>
<plugin
   name="songs"
   author="Terry"
   id="b7cf4507f0fd2b55e2350cc2"
   language="Lua"
   purpose="To sing songs."
   date_written="2008-06-24 21:30:54"
   requires="3.18"
   version="1.0"
   >
</plugin>

<!--  Aliases for the various songs  -->
<aliases>
  <alias
   match="oghams"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'oghams psalm of discipline'</send>
  </alias>
  <alias
   match="rina"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'rina cruinne'</send>
  </alias>
  <alias
   match="bro"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'brothers in arms'</send>
  </alias>
  <alias
   match="lion"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'lion chorus'</send>
  </alias>
  <alias
   match="bshad"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'beyond the shadows'</send>
  </alias>
  <alias
   match="hero"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'march of the heroes'</send>
  </alias>
  <alias
   match="fare"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'fare thee well'</send>
  </alias>
  <alias
   match="regen"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'dreams of the castle'</send>
  </alias>
  <alias
   match="dotm"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'dance of the many'</send>
  </alias>
  <alias
   match="mstar"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'hymn of the morning star'</send>
  </alias>
  <alias
   match="sacrep"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'sacred reprieve'</send>
  </alias>
  <alias
   match="hdir"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'haunted dirge'</send>
  </alias>
  <alias
   match="roc"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'reign of confusion'</send>
  </alias>
  <alias
   match="wos"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'wall of sleep'</send>
  </alias>
  <alias
   match="eye"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'eye of the beholder'</send>
  </alias>
  <alias
   match="sidhe"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'call of the sidhe'</send>
  </alias>
  <alias
   match="art"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'hymn of an artisan'</send>
  </alias>
  <alias
   match="luck"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'dance of the seven luck gods'</send>
  </alias>
  <alias
   match="ssoul"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'sanctuary for the soul'</send>
  </alias>
  <alias
   match="gwar"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'gods of war'</send>
  </alias>
  <alias
   match="flames"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'flames at midnight'</send>
  </alias>
  <alias
   match="cav"
   enabled="y"
   group="songs"
   sequence="100"
  >
  <send>sing 'cry of the avatars'</send>
  </alias>
</aliases>
</muclient>



You can just copy/paste this into a file, save the file under songs.xml, move the file to the MUSHclient/worlds/plugins/ directory, and then use "File|Plugins" to install it. This wasn't written in Lua, though it probably could've been shorter (but more complicated) if it had.

Hope it helps, Terry
Top

Posted by Ain   (3 posts)  Bio
Date Reply #2 on Wed 25 Jun 2008 03:10 AM (UTC)
Message
Thank you Terry so much. Yeah seeing your conversion of that I was like dang.

It was almost as bad as me entering each song as an individual alias.

Buy from your script, I can now alter it to cast every single possible spell too.
Thank you for the work. I'll definitely use it plus, submit it to the mud's forumn.

I had started looking into visual basic a while ago maybe i would be better off using that.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 25 Jun 2008 04:35 AM (UTC)
Message
What you can do is make an alias to make the aliases, like this:


<aliases>
  <alias
   match="#ALIAS * {*}"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
AddAlias ("%1", "%1", "%2", alias_flag.Enabled + alias_flag.Replace, "")
ColourNote ("white", "blue", "Added alias '%1' which sends '%2'")
</send>
  </alias>
</aliases>


See http://mushclient.com/pasting for how to copy that into the client.

That makes an alias that recognizes #ALIAS <something>, so you can then enter your aliases, like this:


#ALIAS ssoul {sing 'sanctuary for the soul'}
#ALIAS gwar {sing 'gods of war'}
#ALIAS flames {sing 'flames at midnight'}
#ALIAS cav {sing 'cry of the avatars'}
#ALIAS oghams {sing 'oghams psalm of discipline'}
#ALIAS rina {sing 'rina cruinne'}
#ALIAS bro {sing 'brothers in arms'}
#ALIAS lion {sing 'lion chorus}
#ALIAS bshad {sing 'beyond the shadows'}
#ALIAS hero {sing 'march of the heroes'}
#ALIAS fare {sing 'fare thee well'}
#ALIAS regen {sing 'dreams of the castle'}
#ALIAS dotm {sing 'dance of the many'}
#ALIAS mstar {sing 'hymn of the morning star'}
#ALIAS sacrep {sing 'sacred reprieve'}
#ALIAS hdir {sing 'haunted dirge'}
#ALIAS roc {sing 'reign of confusion'}
#ALIAS wos {sing 'wall of sleep'}
#ALIAS aye {sing 'eye of the beholder'}
#ALIAS sidhe {sing 'call of the sidhe'}
#ALIAS art {sing 'hymn of an artisan'}
#ALIAS luck {sing 'dance of the seven luck gods'}

Output

Added alias 'ssoul' which sends 'sing 'sanctuary for the soul''
Added alias 'gwar' which sends 'sing 'gods of war''
Added alias 'flames' which sends 'sing 'flames at midnight''
Added alias 'cav' which sends 'sing 'cry of the avatars''
Added alias 'oghams' which sends 'sing 'oghams psalm of discipline''
Added alias 'rina' which sends 'sing 'rina cruinne''
Added alias 'bro' which sends 'sing 'brothers in arms''
Added alias 'lion' which sends 'sing 'lion chorus'
Added alias 'bshad' which sends 'sing 'beyond the shadows''
Added alias 'hero' which sends 'sing 'march of the heroes''
Added alias 'fare' which sends 'sing 'fare thee well''
Added alias 'regen' which sends 'sing 'dreams of the castle''
Added alias 'dotm' which sends 'sing 'dance of the many''
Added alias 'mstar' which sends 'sing 'hymn of the morning star''
Added alias 'sacrep' which sends 'sing 'sacred reprieve''
Added alias 'hdir' which sends 'sing 'haunted dirge''
Added alias 'roc' which sends 'sing 'reign of confusion''
Added alias 'wos' which sends 'sing 'wall of sleep''
Added alias 'aye' which sends 'sing 'eye of the beholder''
Added alias 'sidhe' which sends 'sing 'call of the sidhe''
Added alias 'art' which sends 'sing 'hymn of an artisan''
Added alias 'luck' which sends 'sing 'dance of the seven luck gods''



Quote:

I had started looking into visual basic a while ago maybe i would be better off using that.


I would stick with Lua, it is very powerful, and the ease of use is the same, if not easier, than VB.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ain   (3 posts)  Bio
Date Reply #4 on Wed 25 Jun 2008 09:05 AM (UTC)

Amended on Wed 25 Jun 2008 02:50 PM (UTC) by Ain

Message
HAHAHAHAHAHAHA

We got it to work.

added your alias add..as you said above

the manually enter in

Alias Needs

cut and pasted
#ALIAS ssoul {sing 'sanctuary for the soul'}
#ALIAS gwar {sing 'gods of war'}
#ALIAS flames {sing 'flames at midnight'}
#ALIAS cav {sing 'cry of the avatars'}
#ALIAS oghams {sing 'oghams psalm of discipline'}
#ALIAS rina {sing 'rina cruinne'}
#ALIAS bro {sing 'brothers in arms'}
#ALIAS lion {sing 'lion chorus}
#ALIAS bshad {sing 'beyond the shadows'}
#ALIAS hero {sing 'march of the heroes'}
#ALIAS fare {sing 'fare thee well'}
#ALIAS regen {sing 'dreams of the castle'}
#ALIAS dotm {sing 'dance of the many'}
#ALIAS mstar {sing 'hymn of the morning star'}
#ALIAS sacrep {sing 'sacred reprieve'}
#ALIAS hdir {sing 'haunted dirge'}
#ALIAS roc {sing 'reign of confusion'}
#ALIAS wos {sing 'wall of sleep'}
#ALIAS aye {sing 'eye of the beholder'}
#ALIAS sidhe {sing 'call of the sidhe'}
#ALIAS art {sing 'hymn of an artisan'}
#ALIAS luck {sing 'dance of the seven luck gods'}

into the send box

then changed send to to execute and they where all added perfectly, when i typed

needs




-----------------------------------------------------------
Hmm

That would work then I can create an alias called
alaises

paste the original. And as it read each line I would have a new alias.

Thanks Nick.
______________________________________________________________

Hmmm Maybe if I note then paste each of the original it will work.

I wanna automate it so that I can cut and paste

#ALIAS ssoul {sing 'sanctuary for the soul'}
#ALIAS gwar {sing 'gods of war'}
#ALIAS flames {sing 'flames at midnight'}
#ALIAS cav {sing 'cry of the avatars'}
#ALIAS oghams {sing 'oghams psalm of discipline'}
#ALIAS rina {sing 'rina cruinne'}
#ALIAS bro {sing 'brothers in arms'}
#ALIAS lion {sing 'lion chorus}
#ALIAS bshad {sing 'beyond the shadows'}
#ALIAS hero {sing 'march of the heroes'}
#ALIAS fare {sing 'fare thee well'}
#ALIAS regen {sing 'dreams of the castle'}
#ALIAS dotm {sing 'dance of the many'}
#ALIAS mstar {sing 'hymn of the morning star'}
#ALIAS sacrep {sing 'sacred reprieve'}
#ALIAS hdir {sing 'haunted dirge'}
#ALIAS roc {sing 'reign of confusion'}
#ALIAS wos {sing 'wall of sleep'}
#ALIAS aye {sing 'eye of the beholder'}
#ALIAS sidhe {sing 'call of the sidhe'}
#ALIAS art {sing 'hymn of an artisan'}
#ALIAS luck {sing 'dance of the seven luck gods'}

Then your automated alias adder will put them in for me

_________________________________________________________


nope didn't work. My attempt not yours.

i'll just switch to excel.

find #alias
and replace it with addalias then put it in the middle of yours.
__________________________________________________

This still didn't work

<aliases>
<alias
match="#ALIAS * {*}"
enabled="y"
send_to="12"
sequence="100"
>
<send>
AddAlias ("%1", "%1", "%2", alias_flag.Enabled + alias_flag.Replace, "")










AddAlias ssoul {sing 'sanctuary for the soul'}
AddAlias gwar {sing 'gods of war'}
AddAlias flames {sing 'flames at midnight'}
AddAlias cav {sing 'cry of the avatars'}
AddAlias oghams {sing 'oghams psalm of discipline'}
AddAlias rina {sing 'rina cruinne'}
AddAlias bro {sing 'brothers in arms'}
AddAlias lion {sing 'lion chorus}
AddAlias bshad {sing 'beyond the shadows'}
AddAlias hero {sing 'march of the heroes'}
AddAlias fare {sing 'fare thee well'}
AddAlias regen {sing 'dreams of the castle'}
AddAlias dotm {sing 'dance of the many'}
AddAlias mstar {sing 'hymn of the morning star'}
AddAlias sacrep {sing 'sacred reprieve'}
AddAlias hdir {sing 'haunted dirge'}
AddAlias roc {sing 'reign of confusion'}
AddAlias wos {sing 'wall of sleep'}
AddAlias aye {sing 'eye of the beholder'}
AddAlias sidhe {sing 'call of the sidhe'}
AddAlias art {sing 'hymn of an artisan'}
AddAlias luck {sing 'dance of the seven luck gods'}





ColourNote ("white", "blue", "Added alias '%1' which sends '%2'")
</send>
</alias>
</aliases>


____________________________________________________

world keeps messing it up. I'll figure it out.

LOL
I know if i just entered the aliases in individually, I'd be done by now. But thats not as fun...lol

_____________________________________________

I now have put this
#ALIAS ssoul {sing 'sanctuary for the soul'}
#ALIAS gwar {sing 'gods of war'}
#ALIAS flames {sing 'flames at midnight'}
#ALIAS cav {sing 'cry of the avatars'}
#ALIAS oghams {sing 'oghams psalm of discipline'}
#ALIAS rina {sing 'rina cruinne'}
#ALIAS bro {sing 'brothers in arms'}
#ALIAS lion {sing 'lion chorus}
#ALIAS bshad {sing 'beyond the shadows'}
#ALIAS hero {sing 'march of the heroes'}
#ALIAS fare {sing 'fare thee well'}
#ALIAS regen {sing 'dreams of the castle'}
#ALIAS dotm {sing 'dance of the many'}
#ALIAS mstar {sing 'hymn of the morning star'}
#ALIAS sacrep {sing 'sacred reprieve'}
#ALIAS hdir {sing 'haunted dirge'}
#ALIAS roc {sing 'reign of confusion'}
#ALIAS wos {sing 'wall of sleep'}
#ALIAS aye {sing 'eye of the beholder'}
#ALIAS sidhe {sing 'call of the sidhe'}
#ALIAS art {sing 'hymn of an artisan'}
#ALIAS luck {sing 'dance of the seven luck gods'}

into an alias
needs

I enter the first one and you alias worked

I just nee to make the client think i came from my keyboard input to have them all go in at once.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 26 Jun 2008 01:04 AM (UTC)
Message
I don't quite understand all that.

I added the alias I showed, then copied and pasted all your #alias lines into the command window (in one batch), hit <enter> and they all got added. Where is the problem?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Terry   USA  (87 posts)  Bio
Date Reply #6 on Thu 26 Jun 2008 05:27 PM (UTC)
Message
Instead of putting all that stuff into the script box, you should put it into the command box inside the world. Just copy and paste as a multi-line command. It'll work perfectly. :)
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.


20,092 views.

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

Go to topic:           Search the forum


[Go to top] top

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