Page 1 of 1
One hotkey, two functions? (pause/play)
Posted: Sat Dec 07, 2013 4:02 am
by Devlin
Currently Rearmer can pause/play but involves two hotkeys. I'd like to make it one hotkey that can toggle back and forth. Here's what the code is currently. I keep having glimpses of ideas that fade out so any suggestions would be lovely.
Code: Select all
onhotkey %Hold
{
set %T_Hold #time
set %Sub2 CAOff
}
onhotkey %Play
{
set %Sub2 CAOn
event sysmessage Casting has been resumed. Hit %hold to Pause.
}
Re: One hotkey, two functions? (pause/play)
Posted: Sat Dec 07, 2013 8:35 am
by Xavian
I'm not at my main comp to see for sure, but this is the type of pause my scripts use.
I use this section in the main code where I want the ability to pause:
Code: Select all
onhotkey %Pause
{
set %T_Hold #time
set %Sub2 CAOff
gosub Pause
}
Resume:
And this is just added at the end:
Code: Select all
Sub Pause
{
onhotkey %Pause
{
set %Sub2 CAOn
event sysmessage Casting has been resumed. Hit %hold to Pause.
Goto Resume
}
gosub Pause
}
Re: One hotkey, two functions? (pause/play)
Posted: Sat Dec 07, 2013 5:03 pm
by Dramoor
Or just add a pause menu Button to click. Is easier to click a button and wait for it to hit, than to sit and hold a hotkey waiting for that line to go.
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
menu clear ;
set #menubutton none ;
menu window size 50 40 ;
menu button pause 0 0 100 40 Pause ;
menu show ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; A sub that just checks if you pushed pause ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sub checkPause
{
if #menubutton = pause
{
event exmsg #charid 3 0 Paused
set #menubutton none
while #true
{
wait 10
if #menubutton = pause
{
event exmsg #charid 3 0 Resuming
set #menubutton none
return
}
}
}
return
}
Re: One hotkey, two functions? (pause/play)
Posted: Sat Dec 07, 2013 11:32 pm
by Xavian
Far nicer that way. I haven't done a whole lot with windows other than changing a couple things in a previous script, but I may have to learn
Re: One hotkey, two functions? (pause/play)
Posted: Sun Dec 08, 2013 1:57 am
by Dramoor
Yeah menus are fun and with some things can be a lot easier than using a hotkey, since you have to wait for it to recognize the hotkey, the button stays pushed until next push so it will get recognized on its own. And yeah Menus are fun, I have a nice menu I wrote too that will pm a large group of players whatever you put in the field to say then hit Send and it auto sends that message to whoever u have on the list for it to send to. Far easier to call out a champ that way, as you have to wait for them to send....but you do not have to type [pm name message every time.
Re: One hotkey, two functions? (pause/play)
Posted: Sun Dec 08, 2013 8:59 am
by Xavian
I completely agree. I actually added menus to a couple of my scripts last night and learned a bit about them. I am gonna have to do that more often. I like that idea of the PM script. Certainly could be very useful, I hate sending a PM to a bunch of people like that