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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  New To Mushclient-Help with Aliases
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

New To Mushclient-Help with Aliases

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


Posted by Nyell   (8 posts)  [Biography] bio
Date Thu 09 Dec 2010 08:11 PM (UTC)
Message
Alright, I'm new to mushclient, having previously used G-mud for aetolia. Mushclient is alot mroe complicated and alot more powerful.

I want to understand how to use aliases to create timing triggers, but I've no idea where to start. I understand the 0 as false and 1 as true, but I don't know how to make an alias out of that, or what script to use for a trigger to use that information. I'm looking for a step by step example so I can understand mushclient at least a little more. Any help would be appreciated.
[Go to top] top

Posted by Nyell   (8 posts)  [Biography] bio
Date Reply #1 on Thu 09 Dec 2010 08:45 PM (UTC)
Message
I'll give an example. I want to set up a trigger that attacks a creature when it enters the room. But when another of the same type enters, I want to set my system so that it checks for that and does not attempt to attack until my balance is back. What would that look like?

I've been told that I need to have a variable for balance where having balance = 1 and not having balance =0 but what would that look like? Would it be

Alias: Balance

Send: 0==false
1== true

I know this is a basic question, but I don't really have any foundation to stand on. Guide me through the baby steps and i'll walk on my own.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #2 on Thu 09 Dec 2010 09:53 PM (UTC)

Amended on Thu 09 Dec 2010 09:57 PM (UTC) by Twisol

Message
Nyell said:
I understand the 0 as false and 1 as true, but I don't know how to make an alias out of that, or what script to use for a trigger to use that information.

At a low level, 0 and 1 are just binary states. It could be off/on, in/out, or up/down - 'true' and 'false' are just meanings you apply to these bits. But high-level computer-languages* - like MUSHclient's primary scripting language, Lua - abstract the bits away, showing you only discrete types of data. 0 and 1 in Lua are just numbers, and are considered "true" in all contexts. 'true' and 'false' are their own data-type in Lua, called a boolean. The only values considered false are 'false' and 'nil'. Nil just means there basically is no value.

Now as for balance-tracking, you probably want something like this:
Trigger: You have regained balance.
Send: balance = true
Send to: Script


Trigger: <something that makes you lose balance>
Send: balance = false
Send to: Script


Alias: myattack
Send: if balance then
        Send("cast foo at bar")
      else
        Note("Wait for your balance to come back!")
      end
Send to: Script


That's the basic idea. Combat systems can be pretty tricky on some MUDs, so you might want to start with something else so you can get used to how scripting works in MUSHclient. You may also want to read the excellent "Programming in Lua" online book, which you can find here: http://www.lua.org/pil/

* "high-level" means how for away you are from the "bare metal". High-level languages, as a rule of thumb, let you do complex things in a smaller amount of code. Low-level languages, like assembly language and C, require you to spell out every single step. (These days, it's hard to believe that C was once considered fairly high-level.)

'Soludra' on Achaea

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

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #3 on Thu 09 Dec 2010 11:33 PM (UTC)

Amended on Tue 26 Nov 2013 03:40 AM (UTC) by Nick Gammon

Message
A good place to start is Nick's YouTube Videos for a walk-through and explanation.

https://vimeo.com/nickgammon

[Go to top] top

Posted by Nyell   (8 posts)  [Biography] bio
Date Reply #4 on Fri 10 Dec 2010 02:10 AM (UTC)
Message
Thanks alot. I'm going to try this out now.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 10 Dec 2010 05:00 AM (UTC)
Message
Yes, have a look at all the "getting started" stuff:

http://www.gammon.com.au/forum/?bbtopic_id=120

Also the scripting thread:

http://www.gammon.com.au/scripting

- Nick Gammon

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

Posted by Nyell   (8 posts)  [Biography] bio
Date Reply #6 on Sun 12 Dec 2010 06:09 AM (UTC)

Amended on Sun 12 Dec 2010 06:10 AM (UTC) by Nyell

Message
I have taken a look at most of it, including the introduction to scripting, i'm just having a hard time understanding the context relative to the mud i'm playing, especially if-then statements. Checked out a lua book online too, but the language is pretty heavy, and I didn't understand how the functions applied. Still learning about mush, don't know enough yet. Working on it though, hopefully soon i can answer as many questions as i'll be asking.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Sun 12 Dec 2010 06:22 AM (UTC)

Amended on Sun 12 Dec 2010 06:23 AM (UTC) by Nick Gammon

Message
Nyell said:

I've been told that I need to have a variable for balance where having balance = 1 and not having balance =0 but what would that look like? Would it be ...


I would pretty-much agree with everything Twisol said.

You don't need to use things like 1 and 0 for true and false in Lua, just use the words true and false.

eg. (as he said)


balance = true


So a trigger can match something that says you have balance back and send the above statement to script. It's not complex.

Later on, if a mob comes into the room, you can say "if balance then ...".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


6,092 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 FutureQuest]