Why does this event trigger twice?

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

LamahHerder
a hill giant
a hill giant
Posts: 299
Joined: Sat Jun 29, 2002 2:37 am

Why does this event trigger twice?

Post by LamahHerder » Sat May 15, 2004 7:16 am

Why does this event trigger twice?

test.mac

Code: Select all

#event ToggleNinja "[MQ2] nl#*#"

Sub Main
  /declare NinjaLewt outer
  
  :loop
    /doevents
    /delay 1
    /goto :loop
/end

Sub event_ToggleNinja
  /echo event
  /if (${NinjaLewt}==0) {
    /varset NinjaLewt 1
    /goto :endToggleNinja
    }
  /if (${NinjaLewt}==1) {
    /varset NinjaLewt 0
    /goto :endToggleNinja
    }
    
  :endToggleNinja
/return

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Re: Why does this event trigger twice?

Post by wassup » Sat May 15, 2004 7:27 am

Well, for one thing... read up on what a variable type defaults to if it's type isn't declared.

Then look at your /if statements. YOu will see something wrong.
m0nk wrote:Why does this event trigger twice?

test.mac

Code: Select all

#event ToggleNinja "[MQ2] nl#*#"

Sub Main
  /declare NinjaLewt outer
  
  :loop
    /doevents
    /delay 1
    /goto :loop
/end

Sub event_ToggleNinja
  /echo event
  /if (${NinjaLewt}==0) {
    /varset NinjaLewt 1
    /goto :endToggleNinja
    }
  /if (${NinjaLewt}==1) {
    /varset NinjaLewt 0
    /goto :endToggleNinja
    }
    
  :endToggleNinja
/return

LamahHerder
a hill giant
a hill giant
Posts: 299
Joined: Sat Jun 29, 2002 2:37 am

Post by LamahHerder » Sat May 15, 2004 2:10 pm

Still dont understand why it is triggering 2x 8*(

Code: Select all

#event ToggleNinja "[MQ2] nl#*#"

Sub Main
  /declare NinjaLewt int outer
  
  :loop
    /doevents
    /delay 1
    /goto :loop
/end

Sub event_ToggleNinja
  /echo event
  /if (${NinjaLewt}<1) {
    /varset NinjaLewt 1
    } else {
      /varset NinjaLewt 0
      }
/return

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Sat May 15, 2004 2:23 pm

Do you have mq2telnet loaded, and it's not the latest version of it (or mq2chatwnd same story)? The events handling was moved into MQ2Main. There was previously an event handling call in both MQ2ChatWnd and MQ2Telnet. There's a few scenarios where it would get run twice. a) New MQ2Main, old [MQ2ChatWnd or MQ2Telnet]. b) Old MQ2Main, old MQ2ChatWnd and old MQ2Telnet both loaded.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

LamahHerder
a hill giant
a hill giant
Posts: 299
Joined: Sat Jun 29, 2002 2:37 am

Post by LamahHerder » Sat May 15, 2004 2:26 pm

Yea found that after my 2nd post

I have MQ2-20040514

Plug list

Code: Select all

[Plugins]
mq2labels=mq2labels
mq2itemdisplay=mq2itemdisplay
mq2custombinds=mq2custombinds
mq2hud=mq2hud
mq2fps=mq2fps
mq2map=mq2map
mq2mapfix=mq2mapfix
mq2bzsrch=mq2bzsrch
mq2eqbugfix=mq2eqbugfix
mq2chat=mq2chat
With mq2chat it will trigger twice
If i change mq2chat to mq2chatwnd it will trigger once.