Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
Entire forum
➜ MUSHclient
➜ General
➜ New To Mushclient-Help with Aliases
New To Mushclient-Help with Aliases
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Nyell
(8 posts) 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. | Top |
|
Posted by
| Nyell
(8 posts) 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. | Top |
|
Posted by
| Twisol
USA (2,257 posts) 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 | Top |
|
Posted by
| WillFa
USA (525 posts) 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
| Top |
|
Posted by
| Nyell
(8 posts) Bio
|
Date
| Reply #4 on Fri 10 Dec 2010 02:10 AM (UTC) |
Message
| Thanks alot. I'm going to try this out now. | Top |
|
Posted by
| Nick Gammon
Australia (23,052 posts) Bio
Forum Administrator |
Date
| Reply #5 on Fri 10 Dec 2010 05:00 AM (UTC) |
Message
| |
Posted by
| Nyell
(8 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,052 posts) 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)
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 | 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.
25,485 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top