Retrieving names from in game events

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Retrieving names from in game events

Post by SingleServing » Sat Jan 11, 2003 11:24 pm

If I want to zone in somewhere and calculate the average level of everything in the zone using a who command what would I do to pick out the level of each thing using /who ?

...and if something hit/slashed/bashed/pierced/clawed/stinged/(not nice thing) to me using an event "YOU for" how would I get the name of whatever hit me using the chat text of "a grizzly bear claws YOU for 1 dmg!" without attemping to target and do a $target(name)

My first thoughts were something along the lines of finding the information you want to cut out using

$arg(num,string)
Returns a space delimited substring.
ie. $arg(2,"Am I here?") will return "I"


then

$left(num,string)
Returns a couple of the characters from the left side of string
ie. $left(4,"Am I here?") will return "Am I

to just select the information to the left containing the name.

Any help would be appriciated =)
[color=DarkBlue]Everything,[/color] [color=DarkBlue][b]is[/b][/color] [color=black]black[/color] [color=DarkBlue]and[/color] [color=white]white[/color][color=DarkBlue], when you zoom out it looks[/color] [color=gray]grey[/color][color=DarkBlue].[/color]

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Mon Jan 13, 2003 4:24 am

SS if you look in hunter.mac in the HitsYou event it parses the mobs name out and sets a variable to it. The rest of the dealing with aggro code doesnt work to well but that bit does.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

A test

Post by SingleServing » Tue Jan 14, 2003 10:59 pm

I'd normally just test this but I'm not at home and I'm working on something soooo...
Sub Event_Chat: Event callback for messages
$p0 - Channel of message (ooc etc., chat channels will callback with the name of the channel)
(ie. /join port ... callback will have $p0==port)
$p1 - Name of the person who sent the message
$p2 - Text they sent

Sub Event_name: Custom event callback defined by #event
$p0 - Line that triggered event
If I want to trigger off multiple lines of text like a who npc command would I have to trigger off

"[" ? Assuming thats the first character in the string.

Also, would macroquest be able to do an event check for each line of something at the same time its doing a /who command? I don't think so...

Lastly, if I triggered off of the first line of text on a command like /who npc for example would $p0 only return the first line of code or the entire who?

Possible to write this? Maybe, pain in ass ? Very likely
[color=DarkBlue]Everything,[/color] [color=DarkBlue][b]is[/b][/color] [color=black]black[/color] [color=DarkBlue]and[/color] [color=white]white[/color][color=DarkBlue], when you zoom out it looks[/color] [color=gray]grey[/color][color=DarkBlue].[/color]