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
➜ General
➜ Similar to a recent question....
|
Similar to a recent question....
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
| Posted by
| Tatewaki2365
(34 posts) Bio
|
| Date
| Thu 16 Dec 2004 01:38 AM (UTC) |
| Message
| I was wondering if there was a system of targetting - or, setting a target to complete an alias. As of now, I have this:
Alias: blind
Send: co 'blind'
But! This works only if in direct combat with the person. Now, if I'm CHASING the person, i'm outta luck, and have to type the whole string out (co 'blind' poor-victim) which ultimately takes time that I can't afford to waste. However, I was thinking that there would be a way to set it so that I could set a target (Or leave it blank for direct combat) so that when I'm chasing someone, I can type 'blind' and it will send [co 'blind' victim] - it would have to be easily toggled off (The target) though, because if I type 'blind' while in combat while I, myself, am blind, I'll get a message saying that I can't see that person (Or some such) and the effort is wasted, and I have to type it out anyway. | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #1 on Thu 16 Dec 2004 02:17 AM (UTC) |
| Message
| This will do you, on both accounts. Well, targetting anyway. It also deals with optional arguements, but thats in the alias.
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4695
To get the toggling going, you can simply make an alias to toggle the name off or on. Or you could have it trigger to a "you are blind" message, or some battle message, or something. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Tatewaki2365
(34 posts) Bio
|
| Date
| Reply #2 on Thu 16 Dec 2004 02:33 AM (UTC) |
| Message
| | That targetting system was... Incredibly confusing... | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #3 on Thu 16 Dec 2004 02:39 AM (UTC) |
| Message
| Basically you set a variable (Mushclient variable) and then whenever you want to use it in a trigger/alias, you send @[variable] with 'expand variables' checked.
So, if you had a variable named "target" with the value of "victim", sending "cast blind @target" with expand variables checked would send "cast blind victim".
You can then use an alias to set the target variable. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Thu 16 Dec 2004 02:47 AM (UTC) Amended on Thu 16 Dec 2004 02:48 AM (UTC) by Nick Gammon
|
| Message
| Here's an example. One alias "tar" sets the target. Use "tar none" to cancel it. The other casts blind using the variable "target" as the target ...
<aliases>
<alias
match="^tar (.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if "%1" == "none" then
SetVariable ("target", "")
ColourNote ("white", "blue", "No current target")
else
SetVariable ("target", "%1")
ColourNote ("white", "blue", "Target is now %1")
end -- if
</send>
</alias>
<alias
match="blind"
enabled="y"
expand_variables="y"
sequence="100"
>
<send>co 'blind' @target</send>
</alias>
</aliases>
The scripting is in Lua, but it is readily adaptable to other languages.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #5 on Thu 16 Dec 2004 02:58 AM (UTC) Amended on Thu 16 Dec 2004 02:59 AM (UTC) by Flannel
|
| Message
| Here it is in VB. Since Lua isn't exactly the friendliest language to new coders.
<aliases>
<alias
match="^tar (.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if "%1" = "none" then
SetVariable "target", ""
ColourNote "white", "blue", "No current target"
else
SetVariable "target", "%1"
ColourNote "white", "blue", "Target is now %1"
end if
</send>
</alias>
<alias
match="blind"
enabled="y"
expand_variables="y"
sequence="100"
>
<send>co 'blind' @target</send>
</alias>
</aliases>
|
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Thu 16 Dec 2004 05:06 AM (UTC) Amended on Thu 16 Dec 2004 05:13 AM (UTC) by Nick Gammon
|
| Message
| Flannel, I don't think that there is much difference in friendliness between VB and Lua, especially in those examples:
Lua
if "%1" == "none" then
SetVariable ("target", "")
ColourNote ("white", "blue", "No current target")
else
SetVariable ("target", "%1")
ColourNote ("white", "blue", "Target is now %1")
end -- if
VB
if "%1" = "none" then
SetVariable "target", ""
ColourNote "white", "blue", "No current target"
else
SetVariable "target", "%1"
ColourNote "white", "blue", "Target is now %1"
end if
The intention in each case is pretty obvious. The main differences are:
- Lua uses "==" for equality test, rather than "=".
Personally I think it is less confusing to have two different symbols for two different operations. In VB, for example, you can write this:
b = 2
a = b = 2
Note a ' answer is -1 (true) because b = 2
a = b = 3
Note a ' answer is 0 (false) because b <> 3
Don't you think that "a = b = 2" is confusing, when the "=" symbols mean two different things in a single line?
In Lua you would have to write:
b = 2
a = b == 2
Note (a) ' answer is true because b == 2
a = b == 3
Note (a) ' answer is false because b ~= 3
It is clear there you are doing two different things, assignment and comparison.
- The other major difference is the parentheses on a function call.
Say you are debugging something like this:
In VB you must not write parentheses here, because you are not calling DoAfter as a function. But if you want to check the results, you have to put them in:
result = DoAfter (0, "go north")
Note result
However with Lua, you consistently put in the parentheses, eg.
DoAfter (0, "go north") -- use parentheses
result = DoAfter (0, "go north") -- still use them
Note (result)
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #7 on Thu 16 Dec 2004 06:19 AM (UTC) |
| Message
| No, not in those examples. Because its (basically) all mushclient functions.
But, if you get them onto lua, then once something comes up that isn't quite so easy, then they have to figure it out in Lua on their own. There isnt a ton of sites around for tutorials. If they use VB, I'll bet someone on their mud (probably a couple even) can help them figure something out.
So, no, for that example there wasn't hardly a difference at all, but once they have a handful of lua triggers, aliases, and scripts, switching to VB (which has a larger following, therefore more help outside these forums) will be time consuming. Which means a lot of them won't do it, and they will either give up, or use [random guy on their mud]'s XMud and his set of scripts instead because with MC they're 'stuck' with a language that none of their peers knows, and they don't think they can learn on their own (because there isn't a dozen tutorials out there, or whatever, some people can't just pick up a language from the docs, especially if they haven't coded before, I think anyone would be hard pressed to not know ANYONE who understands VB(S) since it's basically everywhere (BASIC anyway)). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| David Berthiaume
(202 posts) Bio
|
| Date
| Reply #8 on Thu 16 Dec 2004 07:38 AM (UTC) |
| Message
| I switched from VB to Lua!
Of course I had a good... Ok well, not good, but I had several reasons for it.
1.) Gaging single words, and reprinting them is sexah
b.) I like learning new things
iii.) If Nick goes on and on about how good it is, and how he's more or less scripting exclusively in a new language, it probably means it's better. I mean he did write MC after all, and if it meshs with MC better, it's gotta be... better. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #9 on Thu 16 Dec 2004 06:42 PM (UTC) |
| Message
|
Quote:
I think anyone would be hard pressed to not know ANYONE who understands VB(S) since it's basically everywhere (BASIC anyway)).
You make some good points, and I don't really want to get into a "language war". Probably at the end of the day everyone has to choose the language they feel most comfortable with, taking into account:
- Availability
- Ease of coding
- Powerful enough to do what they want, whatever that is
- Ease of debugging
- Online documentation
- Number of people who can help with support
My only comment in support of Lua is that, in cases like I described here:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4957
Lua makes it easier to do things like "do something" - "pause in the script" - "do something else". This is because of its co-routines (threads, effectively).
Now if you start off scripting in VB/Jscript/Perl, and get comfortable in that, and then in six months time want to build a pause into a script, then it gets complicated. Sure, it can be done, but the explanations of how to make it work can be a bit eye-glazing.
Let's look on the bright side - with plugins you can mix languages anyway. Maybe start with VB, and later on if you want to make a "pause inside a script" plugin, then you can, and perhaps learn Lua then.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Tatewaki2365
(34 posts) Bio
|
| Date
| Reply #10 on Thu 16 Dec 2004 10:21 PM (UTC) Amended on Thu 16 Dec 2004 10:27 PM (UTC) by Tatewaki2365
|
| Message
| Alright, so using what little knowledge I have - and mainly logic, I see in the code the line "co 'blind' @target"... After having set the target to... Well... Myself... I didn't really notice that it cast the spell at me.
And before I continue, thank you this. Now then, I'm also looking for it to be associated with different spells as well such as the spell curse, faerie fire, etc etc. Having set aliases for those as well ('curse' = 'co 'curse', etc.), I was wondering if there was a way to make it add the target name after the spells syntax. This may be a little different than what you expected, I'm not sure.. I suppose I worded it wrongly. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #11 on Fri 17 Dec 2004 12:11 AM (UTC) |
| Message
| | What did you type, and what did it reply? Can you copy and paste it? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Tatewaki2365
(34 posts) Bio
|
| Date
| Reply #12 on Fri 17 Dec 2004 12:54 AM (UTC) |
| Message
| Basically, the whole setup on my end is a little messed up;
I have the alias 'blind', send: 'co 'blind'. But there's nothing in that to string the target in there. So I can type 'tar [person]' all I want, but in the end, it won't do anything because my alias is set to use the target function...
I do 'tar [my character]' 'Target set to [my character]
'blind' (I'm in battle with a scarecrow)
A scarecrow appears to be blinded. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #13 on Fri 17 Dec 2004 01:20 AM (UTC) |
| Message
| So you haven't done what we suggested then? The alias was:
co 'blind' @target
That is, it adds the target after the word blind, and the other alias sets up target to be blank (for you) or the name of your target. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Tatewaki2365
(34 posts) Bio
|
| Date
| Reply #14 on Fri 17 Dec 2004 01:25 AM (UTC) |
| Message
| | Oh... Whoops, sorry about that. I suppose I got caught up in the complex system of numbers and letters... Heh, anyway, thanks alot. | | 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.
65,931 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top