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
➜ Plugins
➜ Improved action bar plugin, with cooldowns
Improved action bar plugin, with cooldowns
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #15 on Mon 07 Feb 2011 07:35 PM (UTC) |
Message
| For the target, in the plugin change the line:
replacement = GetPluginVariable ("", s) -- look up variable in global variables
to:
replacement = GetPluginVariable ("de59b5f58559443d5d593585", s) -- look up variable in plugin
That way, at the exact moment it wants the target, it looks it up in the relevant plugin |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #16 on Mon 07 Feb 2011 07:47 PM (UTC) |
Message
| For a trigger to cancel the cooldown in the plugin, something like this:
<triggers>
<trigger
enabled="y"
match="Your fear wears off."
send_to="12"
sequence="100"
>
<send>SetCooldown (4, nil)</send>
</trigger>
</triggers>
To add that to the plugin, copy and paste just before this line:
The simplest way is to add it to the plugin itself.
A more modular way is to make an alias that detects something from your main script file.
So instead of the above, do something like this:
First, add this alias to the plugin (in the place where I said to put the trigger):
<aliases>
<alias
match="cancel_cooldown * in_plugin"
enabled="y"
send_to="12"
sequence="100"
>
<send>SetCooldown (%1, nil)</send>
</alias>
</aliases>
Now add this to another plugin or your main world:
<triggers>
<trigger
enabled="y"
match="Your fear wears off."
omit_from_output="y"
send_to="10"
sequence="100"
>
<send>cancel_cooldown 4 in_plugin</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
What is going to happen here is:
- The trigger matches the message: Your fear wears off.
- The trigger sends "cancel_cooldown 4 in_plugin" to "execute" which means it is evaluated for aliases
- The alias in the plugin detects "cancel_cooldown 4 in_plugin"
- The alias cancels the cooldown
This two-step process lets a non-plugin send a "message" to a plugin. Of course, change the 4 to whatever button this particular message should be cancelling the cooldown for.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Krae
Netherlands (16 posts) Bio
|
Date
| Reply #17 on Mon 07 Feb 2011 07:58 PM (UTC) Amended on Mon 07 Feb 2011 08:07 PM (UTC) by Krae
|
Message
| Wow
Thank you so much for the speedy reply! I had tried for several days and given up only to try for the past weeks again and finally deciding on asking for help.
Now I can work with this again!
I take it that I could also do the opposite by setting a cooldown remotely as well? As a crude demonstration:
match="You fear wears off"
send=SetCooldown (4, 60)
Or even make the aliases as such:
<aliases>
<alias
match="set_cooldown * * in_plugin"
enabled="y"
send_to="12"
sequence="100"
>
<send>SetCooldown (%1, %2)</send>
</alias>
<alias
match="cancel_cooldown * in_plugin"
enabled="y"
send_to="12"
sequence="100"
>
<send>SetCooldown (%1, nil)</send>
</alias>
</aliases>
Again thank you for your help, I'm still always amazed that the very creator just jumps in and helps out everytime. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #18 on Mon 07 Feb 2011 08:04 PM (UTC) |
Message
| Yes, you have it exactly. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Aurion
(6 posts) Bio
|
Date
| Reply #19 on Thu 10 Feb 2011 02:44 PM (UTC) |
Message
| Ok, I've been messing with it a little just to get used to changing the buttons' message they send and I can see how to do it but not with a menu(like the default "Special Attacks" button). Could you give me an examle of a button named "Attacks" that created a menu that would send "Jab", "Thrust" or "Lunge"? I just want to know this so I can see how it's supposed to work. Thanks =D | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #20 on Thu 10 Feb 2011 07:54 PM (UTC) |
Message
| Well it's just like in the example. Can you try it out and post what you have if it doesn't work?
-- button 3
{
icon = "SparkIcon2.png",
tooltip = "Special Attacks",
script = function () -- script to execute when clicked
-- choose from menu
local result = WindowMenu (win,
WindowInfo (win, 14), -- x
WindowInfo (win, 15), -- y
"Jab|Thrust|Lunge")
-- if not cancelled, do action on current target
if result ~= "" then
Send (result:lower () .. " " .. GetPluginVariable ("", "target"))
end -- if
end, -- script function
cooldown = 10 * 60, -- 10 minute cooldown
}, -- end of button 3
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Aurion
(6 posts) Bio
|
Date
| Reply #21 on Thu 10 Feb 2011 09:35 PM (UTC) |
Message
| That's what I tried originally, but I got this:
Error number: 0
Event: Run-time error
Description: [string "Plugin"]:67: attempt to concatenate a nil value
stack traceback:
[string "Plugin"]:67: in function 'script'
[string "Plugin"]:217: in function <[string "Plugin"]:155>
Called by: Function/Sub: mouseup called by Plugin Icon_Bar
Reason: Executing plugin Icon_Bar sub mouseup
--------------------------------
P.S. I see what MIGHT be the problem. I don't want it to output "jab @target" or anything, I just want "Jab" | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #22 on Fri 11 Feb 2011 03:18 AM (UTC) |
Message
| Yes, that was designed to show how you might attack a target. Change:
Send (result:lower () .. " " .. GetPluginVariable ("", "target"))
to:
The "lower" bit just converts the word you choose into lower case. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Aurion
(6 posts) Bio
|
Date
| Reply #23 on Sat 12 Feb 2011 03:43 AM (UTC) |
Message
| Yes, thank you. That worked but if I happen to have any problems again, I'll not them. Thanks =) | Top |
|
Posted by
| Aurion
(6 posts) Bio
|
Date
| Reply #24 on Sat 12 Feb 2011 08:56 PM (UTC) |
Message
| Ok, I read the post earlier about how he would like to have the Action Bar docked at the bottom while not hovering over his prompt(Sort of like the XP Bar plugin) and I was wondering how woudl I go about doing that?
P.S. I'm still new when it comes to scripting MUSHclient, so I apologize for all the questions lately | Top |
|
Posted by
| Krae
Netherlands (16 posts) Bio
|
Date
| Reply #25 on Wed 16 Feb 2011 02:01 PM (UTC) |
Message
| Actually, that part is explained within the plugin itself!
Just find this bit and then change the window position as you want.. remember you can click and drag it too if you want to, it -should- memorize where you last dragged it I think, unless you reload the plugin.
-- where to put the window
WINDOW_POSITION = 6 -- top right
OFFSET = 6 -- gap inside box
EDGE_WIDTH = 2 -- size of border stroke
--[[
Useful positions:
4 = top left
5 = center left-right at top
6 = top right
7 = on right, center top-bottom
8 = on right, at bottom
9 = center left-right at bottom
--]]
In other news! Still loving this plugin a lot.
One thing I'm wondering now is if it would be possible to make a button send/execute an alias when clicked? Since I have attack aliases that go through a script which isn't important. Right now I'm using macros that execute the aliases, but it'd also be nifty if I had a bar of buttons that do the same when clicked. | Top |
|
Posted by
| Musashi
South Korea (1 post) Bio
|
Date
| Reply #26 on Mon 15 Aug 2011 12:49 PM (UTC) |
Message
| Hi Nick,
Thank you so much for this great script. I've been using the basic functions and they are wonderful, but I need some help to properly code the drop-down menu button for a variable spell vs attacking a target. In essence, what the spell does is choose a damage type (from the drop-down menu) then casts the spell to set that damage type. Example is click on button, choose earth, "cast 'spell string' earth" - but I'm having trouble modifying the attack target functions to apply to that kind of spell variable function. Here is the code section for that button:
-- button 6
{
icon = "gaiasfocus.png",
tooltip = "Gaias Focus",
script = function () -- script to execute when clicked
-- choose from menu
local result = WindowMenu (win,
WindowInfo (win, 14), -- x
WindowInfo (win, 15), -- y
"Air|Earth|Cold|Water")
-- if not cancelled, do action on current target
if result ~= "" then
Send (result:lower () .. " " .. GetPluginVariable ("", "target"))
end -- if
end, -- script function
cooldown = 1 * 60 * 15, -- 15 minute cooldown
}, -- end of button 6
Please help modify this code for me to allow for the casting of the spell (cast 'gaias focus' [damtype]) as determined by the player clicking on their desired damtype variable.
Cheers!
| Top |
|
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #27 on Mon 15 Aug 2011 03:40 PM (UTC) Amended on Mon 15 Aug 2011 03:44 PM (UTC) by Fiendish
|
Message
| Musashi, right now if you choose Air what you're sending is "air @target" (where "target" is a variable that you have to create that stores your target mob name) when what you want is to send "cast 'gaias focus' air" without even using a target.
so instead of
Send (result:lower () .. " " .. GetPluginVariable ("", "target"))
use
Send ("cast 'gaias focus' "..result:lower())
result contains your selection choice. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Kovarid
(15 posts) Bio
|
Date
| Reply #28 on Fri 27 Jun 2014 12:53 PM (UTC) Amended on Fri 27 Jun 2014 12:54 PM (UTC) by Kovarid
|
Message
| Hi Nick.
Thanks for this GREAT plugin!
I've modified it for my own use, it uses triggers to catch
cooldowns on my ship's weapons, and lets me know when they
are ready to fire again.
I added support for the tts plugin, so instead of using
sounds the plugin talks to me, and changed to so if you
click on a button that doesn't have a send or script, it
does not start the cooldown.
Since cooldowns can change based on my in-game stats, I've
also made it so cooldowns are re-calculated on the fly if
needed, and saved across sessions.
I'm wondering if there is a way to make separate rows of
buttons, though?
Using the code I'm attaching below, you can see I have 10
buttons total, of 3 different varieties (Disruptor 1/2,4
Forward and 4 aft torpedoes).
I'd like to be able to have the aft torpedo buttons below
the others.. is something like this possible, or maybe I
just need to make a separate window and dock it below the
first?
Code is too big to post here, I've uploaded it to pastebin:
http://pastebin.com/e8GFck1H | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #29 on Fri 27 Jun 2014 08:30 PM (UTC) |
Message
| You could probably do multiple lines fairly easily by fiddling with this code in the middle:
-- where to draw the icon
if horizontal then
x1, y1 = (n - 1) * (ICON_SIZE + OFFSET) + OFFSET, OFFSET
x2, y2 = n * (ICON_SIZE + OFFSET), ICON_SIZE + OFFSET
else
x1, y1 = OFFSET, (n - 1) * (ICON_SIZE + OFFSET) + OFFSET
x2, y2 = ICON_SIZE + OFFSET, n * (ICON_SIZE + OFFSET)
end -- if
That calculates the x and y position of each button. Maybe if "n" is over a certain amount add something to "y1/y2" and subtract something from "x1/x2" to bring you down to line 2.
Plus you would have to make the overall window larger in the y direction.
Or, just make two plugins with different plugin IDs. |
- 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.
131,262 views.
This is page 2, subject is 3 pages long:
1
2 3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top