Page 1 of 1
Irc Events
Posted: Fri May 21, 2004 11:29 am
by antithott
hi,
Im wondering if its possible to use Text sent in irc channel using Irc plugin as a Event for a macro? I for some reason cant get it to work by just adding events like normal.. Anything special i need to add infront of it or something?
Posted: Fri May 21, 2004 12:47 pm
by Micro
If I'm not mistaken, there is only 1 event for IRC
sub Event_IRC
and I think you must handle every line by doing the matching yourself in the subroutine. Obviously this plugin is not efficient, but its better then nothing. Lax said he's working on bot to bot communication with UDP, you might wanna hold out like I am for this to come out.
Posted: Fri May 21, 2004 2:35 pm
by Lax
nah IRC was changed to not use chat events. use normal #events
Posted: Sun Nov 28, 2004 5:01 am
by trandem
i been tryin to get my bots to answer to commands in irc channels, and i cannot figure it out at all, i have seen posts sayin to do all kinds of things,like #chat irc etc. and when i try the #event genbot style,
#event IRCSAY "<#1#> #2#"
#event IRCMSG "<#1#/#*#> #2#"
it never fires off, i use it in the main [mq2] window, is that my problem? i play in 800x600, so im really crammed for space, and its all i can think of
Posted: Sun Nov 28, 2004 10:37 am
by Cr4zyb4rd
Posted: Sun Nov 28, 2004 5:03 pm
by trandem
I dont believe that to be my problem, because the event never fires., for example,
Code: Select all
#event IRCSAY "<#1#> #2#"
#event IRCMSG "<#1#/#*#> #2#"
Sub event_IRCSAY(string ircLine, string ircCommand)
{
/i say command ${ircCommand} recieved in channel
| regurgitate command to show event fired
}
Sub event_IRCMSG(string ircLine, string ircCommand)
{
/i say command ${ircCommand} recieved in prvmsg
| regurgitate command to show event fired
}
i dont get any messages fired back to my irc channel, this should create an insane amount of spam right?
Posted: Sun Nov 28, 2004 5:11 pm
by Cr4zyb4rd
If that's the entirety of your macro, you're "doing it wrong". You also need one of these:
Code: Select all
Sub main
:mymainloop
/doevents
/delay 1
/goto :mymainloop
/return
A macro with no main sub doesn't actually execute any code, you're just defining things.
Posted: Sun Nov 28, 2004 5:21 pm
by trandem
there is more to my macro, i will post it all when i get home, just trying to give an example while im bored here at work.
thanks for fast reply
Posted: Sun Nov 28, 2004 5:44 pm
by Cr4zyb4rd
Not sure if it's related to your problem, but if your subs are matching #1# and #2# you'll need THREE parameters in your sub declaration, as the first will always be the entire line.
Code: Select all
entent_IRCSAY(string ircLine, string ircName, string ircCommand)
Posted: Mon Nov 29, 2004 4:05 am
by trandem
ok, here is the hole deal...
Code: Select all
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| ver: 04.11.28.01 |
| name: Rng.mac |
| author: trandem |
| purpose: |
| hotbutton auto archery, thats it |
| update 04.10.21.01b: add melee, and toggle sytem, sounds for afk, |
| forage/snare/taunt. added xp notice on mob death. and wait4rez/autoloot |
| your corpse after res |
| |
| Requirements: What you need to make this shit work! you must have mq2irc, |
| and mq2PlaySound, or comment out all lines that start with |
| "/i say" and "/sound" |
| |
| credits: original work by trandem and wait for res from mq2 snippets forum, toggle section |
| inspired by rogue helper (rh.mac) |
|_______________________________________________________________________________________________________|
|#turbo 40
| spell_routines is for no-fail casting
#include spell_routines.inc
| anchor.inc is for anchor functions, it must be initialized
#include anchor.inc
#Chat Chat
#Chat tell
#Chat Group
#event NoLOS "#*#You cannot see your target.#*#"
#event CantHit "#*#You cannot hit your target#*#"
#event TooClose "#*#target is too close#*#"
#event NoRanged "#*#ranged weapon equipped#*#"
|#event StartAutoRng "#*#[MQ2] AutoArch#*#"
#event GainedXp "#*#you gain#*#experience#*#"
#event JooDied "#*#you have been slain#*#"
#Event Zoned "#*#You have entered#*#"
#event AutoAcceptGroup "#*#To join the group#*#"
#event RageOn "#*#|${Target.CleanName}| has become ENRAGED#*#"
#event RageOn "#*#|${Target.CleanName}| has become INFUR#*#"
#event RageOff "#*#|${Target.CleanName}| is no longer enraged#*#"
#event RageOff "#*#|${Target.CleanName}| is no longer INFUR#*#"
#event Toggle "[MQ2] Toggle #1#"
#event Toggle "[MQ2] Toggle #1# #2#"
#event MacHelp "[MQ2] help"
#event IRCSAY "<#1#> #2#"
#event IRCMESSAGE "<#1#/#*#> #2#"
Sub main
/sound
/echo <---===(Rng.mac Starting)===--->
/i say <---===(Rng.mac Starting)===--->
| declares
/declare BowRange int outer 30
/declare LDExp float outer
/declare AAExp float outer
/declare RGExp float outer
/declare TLDExp float outer
/declare TAAExp float outer
/declare TRGExp float outer
/declare MobName string outer
/declare CantHitSpam bool outer
/declare MinMelee float outer 10
/declare MeleeDistance float outer 15
/declare MaxMelee float outer 20
/declare UseMaxMelee bool outer false
/declare RetResult sring outer
/declare DeadNeedRes bool outer false
|Toggles
/declare AutoArch bool outer false
/declare AutoForage bool outer false
/declare AutoSnare bool outer false
/declare AutoAssist bool outer false
/declare AutoMelee bool outer false
/declare AFKNotice bool outer false
|aliases
/squelch /alias /AutoArch /echo Toggle AutoArch
/squelch /alias /rnghelp /echo help
/squelch /alias /forage /echo Toggle AutoForage
/squelch /alias /snare /echo Toggle AutoSnare
/squelch /alias /autoassist /echo Toggle AutoAssist
/squelch /alias /melee /echo Toggle AutoMelee
/squelch /alias /taunt /echo Toggle AutoTaunt
/squelch /alias /afkn /echo Toggle AFKNotice
|xp stuff
/varset LDExp ${Me.PctGroupLeaderExp}
/varset AAExp ${Me.PctAAExp}
/varset RGExp ${Me.PctExp}
/varset TLDExp ${Me.PctGroupLeaderExp}
/varset TAAExp ${Me.PctAAExp}
/varset TRGExp ${Me.PctExp}
/echo <---===(Rng.mac Initialization complete)===--->
/echo /rnghelp for commands
/i say <---===(Rng.mac Initialization complete)===--->
/i say /rnghelp for commands
:MainLoop
/doevents
/if (${AutoArch}) {
/varset MobName ${Target.Name}
/call BOW_ATTACK
}
/Call ForageShit
/if (${Me.Combat} && !${Target.ID}==NULL && ${AutoMelee}) {
/varset MobName ${Target.Name}
/Call MELEE_ATTACK
}
/goto :MainLoop
/i say bowmac exited
/return
sub BOW_ATTACK
/i say Rng.mac has engaged on ${Target.Name}
:bowloop
/doevents
/Call ForageShit
/if (${Target.ID} == NULL) {
/i say no target!
} else /if (${Target.Distance} > 500) {
/echo ${MobName} to far away
/i say ${MobName} to far away
} else /if (!${AutoArch}) {
/echo user ended attack on ${MobName}
/i say user ended attack on ${MobName}
} else /if (${Target.PctHPs}>0) {
/if (${Target.Distance}> ${BowRange}) {
/if (!${Me.Stunned}&& ${Me.RangedReady}) {
/ranged
}
/doevents
/goto :bowloop
} else /if (${AutoMelee}) {
/call MELEE_ATTACK
}
}
/doevents
/varset AutoArch false
/return
Sub MELEE_ATTACK
/i say Melee mode Engaged on ${MobName}
/varcalc MinMelee ${Target.MaxRangeTo} - 10
/varcalc MeleeDistance ${Target.MaxRangeTo} -2
/varset MaxMelee ${Target.MaxRangeTo}
/attack on
:attackMeleeLoop
/doevents
/if (${Target.ID} == NULL) {
/i say no target, exiting melee mode
/attack off
} else /if (!${Me.Stunned} && !${Me.Casting.ID}) {
|-- keeps us in melee distance
/if (${Target.Distance} > ${MaxMelee}) {
/face fast nolook
/keypress FORWARD HOLD
} else /if (${Target.Distance} > ${MeleeDistance}) {
/face fast nolook
/keypress FORWARD
} else /if (${Target.Distance} < ${MinMelee}) {
/face fast nolook
/keypress BACK
}
/if (${Me.AbilityReady[taunt]} && ${AutoTaunt}) /doability taunt
}
/if (${Me.Combat}) {
/goto :attackMeleeLoop
}
/return
Sub event_NoLOS
/if (${Target.ID} != NULL) /face fast nolook
/return
Sub event_CantHit
/if (!${CantHitSpam}) {
/i say cant hit ${MobName} from here, stopping attack
/varset AutoArch false
/varset CantHitSpam true
}
/return
Sub event_TooClose
/varcalc BowRange ${BowRange} + 1
/return
Sub event_NoRanged
/echo Toggle AutoArch
/return
Sub event_StartAutoRng
/varset AutoArch true
/return
Sub event_GainedXp
/i say <---===(Rng.mac ${Me.Name} XP 411)===--->
/i say LAST MOB: last mob REG (${Math.Calc[${Me.PctExp}-${RGExp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
/i say TOTAL: REG (${Math.Calc[${Me.PctExp}-${TRGExp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${TAAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${TLDExp}]}%)
/varset LDExp ${Me.PctGroupLeaderExp}
/varset AAExp ${Me.PctAAExp}
/varset RGExp ${Me.PctExp}
/return
Sub event_AutoAcceptGroup
/invite
/i say you have joined the group!
/sound 2
/return
Sub event_RageOn
/if (${AutoMelee}) {
/attack off
/i say ${MobName} HAS ENRAGED! melee attack mode paused!
}
/return
Sub event_RageOff
/if (${AutoMelee}) {
/attack on
/call MELEE_ATTACK
}
/return
Sub event_JooDied
/i say i have died
/i say !res meh!
/varset DeadNeedRes true
/call Wait4Rez
/return
Sub event_MacHelp
/echo <---===(Rng.mac help)===--->
/echo /AutoArch - Toggles archery
/echo /forage - toggles auto foraging
/echo /snare <%> - toggles snare, and what % to do it at
/echo /autoassist <name> - toggles auto assist, and who to assist
/echo /melee - toggles melee on, or bow only
/echo /taunt - toggles taunt on
/return
Sub event_zoned
/if (${DeadNeedRes}) {
/delay 2s
/consent raid
/delay 3s
/consent group
}
/return
| ********************* This part is taken from wait4res.
Sub Wait4Rez
:waitforrez
/doevents
/if (!${Window[ConfirmationDialogBox].Open}) {
/delay 5s ${Window[ConfirmationDialogBox].Open}
/goto :waitforrez
}
/if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup
/varset DeadNeedRes False
:zonein
/doevents
/delay 5
/squelch /target mycorpse
/delay 5
/if (${Target.CleanName.NotEqual[${Me}'s corpse]}) /goto :zonein
/if (${Target.CleanName.Equal[${Me}'s corpse]}) {
/delay 3s
/call Loot_Corpse
} else /goto :zonein
/return
Sub Loot_Corpse
/declare LootTotal int local 0
/declare LootSlot int local
/squelch /target mycorpse
/if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) {
/i say ** Can't target my corpse.
/return
}
/corpse
/delay 1s
/loot
/delay 1s
/if (${Me.State.NotEqual[BIND]}) {
/echo ** Massive lag right now... Aborting looting.
/return
}
:LootLag
/if (${LootTotal}!=${Corpse.Items}) {
/varset LootTotal ${Corpse.Items}
/delay 5
/goto :LootLag
}
/for LootSlot 1 to ${LootTotal}
:LootItem
/itemnotify loot${LootSlot} rightmouseup
/delay 3
/if (${Corpse.Item[${LootSlot}].ID}) {
/delay 2
/goto :LootItem
}
/next LootSlot
/delay 5
/i say ** Done looting my corpse.
/notify LootWnd DoneButton leftmouseup
/return
Sub Event_Toggle(string Line, string Command, string Command2)
/if (${Command.Equal[AutoArch]}) {
/if (${AutoArch}) {
/varset AutoArch false
/i say Auto archery disabled
} else {
/varset AutoArch true
/i say Auto archery enabled
}
} else /if (${Command.Equal[AutoForage]}) {
/if (${AutoForage}) {
/varset AutoForage false
/i say Auto Foraging disabled
} else {
/varset AutoForage true
/i say Auto Foraging enabled
}
} else /if (${Command.Equal[AutoSnare]}) {
/if (${AutoSnare}) {
/varset AutoSnare false
/i say Auto Snaring disabled
} else {
/varset AutoSnare true
/i say Auto Snaring enabled
}
} else /if (${Command.Equal[AutoAssist]}) {
/if (${AutoAssist}) {
/varset AutoAssist false
/i say Auto Assist disabled
} else {
/varset AutoAssist true
/i say Auto Assist enabled
}
} else /if (${Command.Equal[AutoMelee]}) {
/if (${AutoMelee}) {
/varset AutoMelee false
/i say Auto Melee disabled
} else {
/varset AutoMelee true
/i say Auto Melee enabled
}
} else /if (${Command.Equal[AutoTaunt]}) {
/if (${AutoTaunt}) {
/varset AutoTaunt false
/i say Auto Taunting disabled
} else {
/varset AutoTaunt true
/i say Auto Taunting enabled
}
} else /if (${Command.Equal[AFKNotice]}) {
/if (${AFKNotice}) {
/varset AFKNotice false
/i say AFK notice disabled
} else {
/varset AFKNotice true
/i say AFK notice enabled
}
}
/return
Sub ForageShit
/if (${AutoForage}) {
/if (!${Me.Casting.ID} && ${Me.Standing} && !${Me.Combat} && !${Me.Stunned}) {
/if (${Me.AbilityReady[forage]}) {
/doability forage
:Keep
/doevents
/delay 5
/if (!${Cursor.ID}) /return
/echo Found ${Math.Calc[${FindItemCount[${Cursor.Name}]}+1].Int} ${Cursor.Name}'s so far!
/popup Found ${Math.Calc[${FindItemCount[${Cursor.Name}]}+1].Int} ${Cursor.Name}'s so far!
/mqlog Found ${Math.Calc[${FindItemCount[${Cursor.Name}]}+1].Int} ${Cursor.Name}'s so far!
/autoinv
/if (${Cursor.ID}) /goto :Keep
}
}
}
/return
Sub SnareShit
:resnareit
/doevents
/if (${Target.PctHPs} < 51 && !${MobSnared}) {
/call Cast "Ensnare"
/delay 1s
}
/return
Sub event_IRCSAY(string ircLine, string ircSender,string ircText)
/if (${ircText.Equal[!bow]}) {
/i say autobow initiated
/assist raid
/echo AutoArch
} else /if (${ircText.Equal[!status]}) {
/i say <---===(Rng.mac Initialization complete)===--->
/i say Leader xp = ${LDExp}
/i say AA xp = ${AAExp}
/i say Regular xp = ${RGExp}
/i say Total leader xp = ${TLDExp}
/i say Total aa xp = ${TAAExp}
/i say Total regular xp = ${TRGExp}
/i say Mob Name is ${MobName}
/i say AutoArch = ${AutoArch}
/i say AutoForage = ${AutoForage}
/i say AutoSnare = ${AutoSnare}
/i say AutoAssist = ${AutoAssist}
/i say AutoMelee = ${AutoMelee}
/i say AutoTaunt = ${AutoTaunt}
} else /if (${ChatType.Equal[TELL]}) {
/i say received a tell from ${Sender} data:${ChatText}
/if (${AFKNotice}) /sound 2
}
/return
Sub event_IRCMESSAGE(string ircLine, string ircSender,string ircText)
/if (${ircText.Equal[!bow]}) {
/i say autobow initiated
/assist raid
/echo AutoArch
} else /i say not recognized | should spam like a bastard for testing event trigger
/return
all the toggle funtions work fine, for arch/forage, etc
Posted: Mon Nov 29, 2004 6:32 am
by Cr4zyb4rd
That's great, but now I have to read through your whole deal...
make a macro with JUST the irc events, and have them JUST echo their args when they trigger. Then you'll know you're doing that part right, and you can cobble it onto your ranger macro.
Posted: Sun Dec 19, 2004 1:14 pm
by Marze
This will work...
Code: Select all
#Event Camp "<#1#> Camp"
Sub Event_Camp
/camp
/return
Sub Main
:Loop
/doevents
/goto :Loop
/return
Send the msg by typing /i msg #channel Camp
Posted: Tue Feb 08, 2005 2:24 pm
by frabtik
From my genbot. Maybe more than you looking for but should cover what you need.
Code: Select all
#event IRC "<#1#> #*#"
Sub Event_IRC(string IRCText,string IRCSender)
/declare NameLength int local 0
/if (${String[${MasterList.Lower}].Find[${IRCSender.Lower}]}) {
/if (${CheckName}) {
/if (${String[${IRCText.Find[${Me.CleanName}]}]}) {
/varset NameLength ${Me.CleanName.Length}
/varcalc NameLength ${NameLength}+1
} else {
/return
}
}
/varcalc NameLength ${NameLength}+${IRCSender.Length}
/varcalc NameLength ${NameLength}+3
/varset IRCText ${IRCText.Right[-${NameLength}]}
/call ExecCommand "${IRCText}"
/return
}
/return