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.
Entire forum
➜ MUSHclient
➜ Tips and tricks
➜ Targetting
Posting of new messages is disabled at present.
Refresh page
Pages: 1 2
Posted by
| LindZ
(7 posts) Bio
|
Date
| Tue 05 Nov 2002 02:58 PM (UTC) |
Message
| This might be a bit basic for most of you so many apologies. I was wandering how to set up a targetting system. By this I mean if in a fight and I am currently hitting Bill and I wish to change and hit Benjamin instead. What would be the best method of doing this without having to type: Punch Benjamin, Kick Benjamin and instead maybe type something like t1 = Benjamin to assign the name Benjamin to a variable. Then my aliases would target that variable (t1) allowing me to just type Punch, Kick and the attacks land on Benjamin. Also would I then be able to set up multiple targets and maybe cycle through them? Any ideas? | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 05 Nov 2002 09:34 PM (UTC) |
Message
| You can do that with a few aliases. To allow for multiple targets I have done the idea of first setting up your potential targets, and then choosing one.
eg.
t1 = Bill
t2 = Benjamin
t1 (choose target 1)
kick (kicks Bill)
t2 (choose target 2)
kick (kicks Benjamin)
The plugin below allows for up to 9 targets, with "kick", "punch" and "stab" actions. You can add more actions by amending the appropriate alias.
Just copy the stuff below the line and paste into a notepad window. Save as TargetSwitch.xml, and then add that into MUSHclient using the plugins dialog.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, November 06, 2002, 9:25 AM -->
<!-- MuClient version 3.30 -->
<!-- Plugin "TargetSwitch" generated by Plugin Wizard -->
<!--
See: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1947
-->
<muclient>
<plugin
name="TargetSwitch"
author="Nick Gammon"
id="2adec0ac37689537f9e3daf2"
language="VBscript"
purpose="Demonstrates switching targets"
save_state="y"
date_written="2002-11-06 09:20:06"
requires="3.23"
version="1.0"
>
<description trim="y">
<![CDATA[
Demonstrates how you can switch targets with a couple of aliases.
Usage
-----
t1 = person (set target 1)
t2 = person (set target 2)
t3 = person (set target 3) ... and so on up to 9 ...
t1 (choose target 1)
t2 (choose target 2)
t3 (choose target 3) ... and so on up to 9 ...
punch (punch target)
kick (kick target)
eg.
t1=Bill (target 1 is Bill)
t2=Benjamin (target 2 is Benjamin)
t1 (choose Bill)
kick (kick Bill)
t2 (choose Benjamin)
kick (kick Benjamin)
t1 (choose Bill again)
punch (punch Bill)
kick (kick Bill)
t2 (choose Benjamin again)
punch (punch Benjamin)
kick (kick Benjamin)
TargetSwitch:help <-- this help
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
script="SetTarget"
match="^t([1-9])\s*\=\s*(.+)$"
enabled="y"
regexp="y"
>
</alias>
<alias
script="ChooseTarget"
match="^t([1-9])$"
enabled="y"
regexp="y"
>
</alias>
<alias
match="^(kick|punch|stab)"
enabled="y"
expand_variables="y"
regexp="y"
>
<send>%1 @target</send>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
sub SetTarget (sName, sLine, wildcards)
dim which, to_whom
which = wildcards (1)
to_whom = wildcards (2)
world.SetVariable "target" & which, to_whom
world.ColourNote "moccasin", "darkgreen", _
"Target " & CStr (which) & " now '" & to_whom & "'"
end sub
sub ChooseTarget (sName, sLine, wildcards)
world.SetVariable "target", _
world.GetVariable ("target" & wildcards (1))
world.ColourNote "moccasin", "darkgreen", _
"Target now '" & _
world.GetVariable ("target") & "'"
end sub
]]>
</script>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="TargetSwitch:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
World.Note World.GetPluginInfo (World.GetPluginID, 3)
End Sub
]]>
</script>
</muclient>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| LindZ
(7 posts) Bio
|
Date
| Reply #2 on Wed 06 Nov 2002 12:06 PM (UTC) |
Message
| Thanx for the plugin Nick. Just one more quick question. How would I then use those targets in a trigger? If i have just been punched by Bob and Bob is t3-
Trigger text: Bob punches you.
Send: punch t3
Tried something similar to the above but Bob is not targetted?
Thanx again,
LindZ | Top |
|
Posted by
| LindZ
(7 posts) Bio
|
Date
| Reply #3 on Wed 06 Nov 2002 12:09 PM (UTC) |
Message
| Oh and I do realize that I could just do-
Trigger text: * punches you.
Send: punch %1
However this doesn't have the effect I require in all circumstances. | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #4 on Wed 06 Nov 2002 04:56 PM (UTC) |
Message
| You need to set the trigger to expand variables, and then have it send: punch %t3
Unfortunately, there is no graphical interface for editing alias, trigger, variable settings for a plugin. You would need to open the trigger's xml file, and manually add the trigger code there.
You can edit the plugin quickly by opening the plugins menu in MUSHclient, selecting the plugin, then pressing the "edit" button.
If you aren't sure how the trigger code should look, you can try creating it in your main world file... Then select it from the list of triggers, click the "copy" button. Next the "remove" button to delete it from your main world. While it's still in 'clipboard' memory, go edit the plugin as described above, and "paste" the trigger code in. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 06 Nov 2002 10:20 PM (UTC) |
Message
|
Quote:
You need to set the trigger to expand variables, and then have it send: punch %t3
You mean: punch @t3
Make sure "expand variables" is set.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| LindZ
(7 posts) Bio
|
Date
| Reply #6 on Fri 08 Nov 2002 07:34 AM (UTC) |
Message
| Hi there guys. I tried the Epand variables thing and then sent: punch @t3. However this did not seem to work? As an example of one of the functions I require this to work for. Say I am preparing a spell-
I make an alias for the spell eg. alias name : pf, send : prepare fireball.
This takes a second to prepare and then the text: Fireball spell ready. Appears on screen.
I have created a trigger to pick up on: Fireball spell ready.
The trigger then sends: Cast Fireball @t3.
On the output the text: Cast Fireball appears but no target is designated?
Any ideas why this is and what I can do about it? | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 08 Nov 2002 07:54 AM (UTC) |
Message
| That should certainly work.
Check you have 'expand variables' set in the "cast fireball" alias.
Also check that t3 variable is set. Look in the world configuration screen, scroll to the very last item "variables" and check it appears there.
Actually, now that I wrote that, I see a possible problem. The variables are "local" to a plugin. That is, if you are using my plugin then t3 in the plugin is not the same as t3 in the world.
One workaround is to take the alias from the main world, and click on the "copy" button, then edit the plugin and paste that alias into the aliases you see there.
ie. just after <aliases>
Then delete the alias from the main world window. That way you have moved it to the plugin. Save the plugin, go to the plugins window, select it and click "reinstall" and it should work. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| LindZ
(7 posts) Bio
|
Date
| Reply #8 on Fri 08 Nov 2002 09:37 AM (UTC) |
Message
| Nick, Thanx for all the help. With the advice that you gave me I finally got the trigger to work by adding the triggers I required to the plugin. Easy when you know how huh? Ok well once again, cheers for all the support.
LindZ. | Top |
|
Posted by
| Drazzen
(11 posts) Bio
|
Date
| Reply #9 on Sat 09 Nov 2002 07:26 PM (UTC) |
Message
| I see what you are doing but the MUD I play has hundreds of players. I am looking for a way to make a targetting system where I just need to type : Targ <name> for example to set the target and then I can set my attacks to reference whatever is currently set as the target.
The MUD I play (www.ACHAEA.com) has a command in game [settarget <var> <name>]to set targets but that is too much to type in the heat of battle. I am trying to find a way to make targetting quick and easy.
Any suggestions? | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #10 on Sat 09 Nov 2002 10:54 PM (UTC) |
Message
| If you just want to set one target it is a lot easier. Add this to your script file:
sub SetTarget (sName, sLine, wildcards)
world.SetVariable "target", wildcards (1)
end sub
Then make a "targ" alias like this:
<aliases>
<alias
script="SetTarget"
match="targ *"
enabled="y"
>
</alias>
</aliases>
Then just type "targ Bill" to set your target. To make some use of this use "@target" in other triggers and aliases where you want to refer to the current target (and check "expand variables").
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jorge
(2 posts) Bio
|
Date
| Reply #11 on Sun 21 Jan 2007 10:01 PM (UTC) |
Message
| How do I make this so I can use more attcks than just kick punch etc. I would like to use my bop attack with the targeting system. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #12 on Mon 22 Jan 2007 01:26 AM (UTC) |
Message
| I'm not sure what the problem is. You can make multiple aliases that all do something like: kick @target
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jorge
(2 posts) Bio
|
Date
| Reply #13 on Mon 22 Jan 2007 05:22 PM (UTC) |
Message
| Im not sure how to do that, I am extreamly new to this maybe you could refer me to a good tutorial on scripting, aliases, etc. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #14 on Mon 22 Jan 2007 07:34 PM (UTC) |
Message
| |
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.
73,181 views.
This is page 1, subject is 2 pages long: 1 2
Posting of new messages is disabled at present.
Refresh page
top