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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Improved action bar plugin, with cooldowns

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Improved action bar plugin, with cooldowns
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Fiendish   USA  (851 posts)  [Biography] bio   Global Moderator
Date Mon 15 Aug 2011 03:40 PM (UTC)  quote  ]

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.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Musashi   South Korea  (1 post)  [Biography] bio
Date Mon 15 Aug 2011 12:49 PM (UTC)  quote  ]
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!
[Go to top] top

Posted by Krae   Netherlands  (16 posts)  [Biography] bio
Date Wed 16 Feb 2011 02:01 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Aurion   (6 posts)  [Biography] bio
Date Sat 12 Feb 2011 08:56 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Aurion   (6 posts)  [Biography] bio
Date Sat 12 Feb 2011 03:43 AM (UTC)  quote  ]
Message
Yes, thank you. That worked but if I happen to have any problems again, I'll not them. Thanks =)
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Fri 11 Feb 2011 03:18 AM (UTC)  quote  ]
Message
Yes, that was designed to show how you might attack a target. Change:


Send (result:lower () .. " " .. GetPluginVariable ("", "target"))


to:



Send (result:lower ())



The "lower" bit just converts the word you choose into lower case.

- Nick Gammon

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

Posted by Aurion   (6 posts)  [Biography] bio
Date Thu 10 Feb 2011 09:35 PM (UTC)  quote  ]
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"
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Thu 10 Feb 2011 07:54 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Aurion   (6 posts)  [Biography] bio
Date Thu 10 Feb 2011 02:44 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Mon 07 Feb 2011 08:04 PM (UTC)  quote  ]
Message
Yes, you have it exactly.

- Nick Gammon

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

Posted by Krae   Netherlands  (16 posts)  [Biography] bio
Date Mon 07 Feb 2011 07:58 PM (UTC)  quote  ]

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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Mon 07 Feb 2011 07:47 PM (UTC)  quote  ]
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:


<!--  Script  -->


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>


Template:pasting 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
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Mon 07 Feb 2011 07:35 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Krae   Netherlands  (16 posts)  [Biography] bio
Date Mon 07 Feb 2011 06:41 PM (UTC)  quote  ]

Amended on Mon 07 Feb 2011 06:42 PM (UTC) by Krae

Message
I know it's possible, but I can't for the life of me figure out what would be better:
I have a button that will basically put up a defense when clicked, the defense will wear off after some time. I wanted to make a trigger of the line when it wears off so that it raises it automatically, however the visual cooldown is very useful so I was either contemplating of making a trigger in mushclient self that would also activate the button cooldown, or perhaps putting this trigger straight into the plugin, though I wouldn't quite know for sure how to do this, though it would involve the function of "SetCooldown [button number], [amount of seconds]" (I presume!)

On another note: I tried the above with getting the variable from another plugin, but I'm not sure on where I put the line "target = bladida" whether I put that inside the CDATA part

Right now I have it just above that (which doesn't work)


<!--  Script  -->

<script>

-- pull in entities outside the CDATA block

horizontal = ("&horizontal;"):lower ():sub (1, 1) == "y";
show_time = ("&show_time;"):lower ():sub (1, 1) == "y";
target = GetPluginVariable ("de59b5f58559443d5d593585", "target")

<![CDATA[

-- table of buttons


Thank you for your time and help. I appreciate it.
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Sun 16 Jan 2011 09:53 PM (UTC)  quote  ]

Amended on Sun 16 Jan 2011 09:54 PM (UTC) by Nick Gammon

Message
Certainly you could put text on the button. That is how the cooldown numbers are done. Look in the plugin around where it says "-- if they want to see the time left ... do that now". You use WindowText with an appropriate font, and positioned where you want it, to do that. Naturally you draw the button first and the text second.

As for getting the variable from another plugin, this is the general idea:


target = GetPluginVariable ("f8f2cedd9f981f80b491666c", "target")


(Where "f8f2cedd9f981f80b491666c" is the plugin ID of the other plugin).

Now you have the "target" variable from a different plugin, you use it in the Send function or whatever you want to do with it.

- 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.


16,746 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]