Question limiting a command inside a sub that basically never stops

supertimmy

Lifetimer
Joined
Aug 20, 2008
Messages
367
Reaction score
4
Points
0
so i've got this macro. it's pretty damn bad! but it does what i want. kinda! so i have an alert sub and it does a loop over and over until i cancel the macro. which is probably not ideal, but this is uncharted territory for me. in that sub it spams my fellowship window, but i'd also like to send a text with /mmotext. but just once. is this possible?

pls be gentle with me.
 
Post the sub so we know how your doing it.

It's quite easy to create a variable to be used only once, like so.

Code:
/declare DoOnce int outer 0

Sub Main
:top
/if (${DoOnce}==0) {
    /mmotext MACRO IS STARTED
    /varset DoOnce 1
   }
/goto :top

This wont send another mmotext, because Variable DoOnce is now 1 not 0
 
Code:
Sub Alarm(string id)
      /echo ${id} UP @ ${Time}
      /beep
      /fs STUFF
      /delay 1
      /beep
      /delay 1
      /mmotext STUFF
return

so this is the part that is going nonstop. and that's ok. but i don't need 30 texts before i can either reach my computer or tab to the window and stop the macro.

and the text thing is really in case i'm in another room or maybe pooping. i don't have speakers, just headphones so the text is really just a beep that i'll hear.

if i used a goto instead of a return, i'd just get back to the alarm sub and have the same problems. i think. but if i add the declare and put the if structure in the alarm sub, then problem solved?
 
I'd use something like a timer

Code:
/declare TextTimer	int outer	0

Sub Alarm(string id)
      /echo ${id} UP @ ${Time}
      /beep
      /fs STUFF
      /delay 1
      /beep
      /delay 1
      /if (!${TextTimer}) {
         /mmotext STUFF
        /varset TextTimer 15m
      }
/return

This would only allow a text message to be sent every 15mins. Play with it how you feel