2 replies [Last post]
VonHenry
VonHenry's picture
User offline. Last seen 2 years 20 hours ago. Offline
Joined: 11/20/2009
Posts: 45

So, I'll take this code from Phil in a recent post.

<<All>>
Macro /assist %$Leader%
Chan 1
Set Toon,%SaveToon%
if %Toon% > 5
<<All>>
Hit -
Chan 1
else
Chan %Toon%
Hit -
endif

What exactly does "Chan 1" do/ How does it work?

I understand it 'resets the active channel'. However, why I'm lost is, it seems very backwards. When we set a macro, when ALL Hit a key, we rest back to Chan 1 (is that because <<ALL>> defaults to a Chan all?) but yet when we specifically say Chan %Toon% (which could be 1, 2, ..., 5), we don't bother resetting back to Chan 1.

I don't quite get it.

Phil
Phil's picture
User offline. Last seen 2 weeks 4 days ago. Offline
Joined: 06/30/2009
Posts: 571
It's a fiddle!

There are are number of things to explain.

Firstly GCP sends to channels, not toons.

Internally "<<Toon1>>" is converted to "chan 1", "<<Toon2>> to "chan 2" and <<All>> to chan 1,2,3,4,5 etc.

This conversion is dynamic so <<DPS>> will expand to different things, depending on who is in the DPS group at the moment.

Now Chan 1,2,3,4,5 means repeat the next "block of commands" for channels 1 thru 5 (i.e. loop 5 times). In this context "block of commands" means anything between the current chan instructions and the next chan instructions (or the end of the command).

This makes sense because we can write:

<<All>>
command1
<<Toon3>>
Command2
<<DPS>>
Command3

Command1 will be done for all toons, command2 will be done just once, and command3 will be done for any toons in the DPS group.

The fiddle is to do with if, else, endif. Basically else flips a status (i.e. makes a true false or vice versa). If the else was executed multiple times, then things would get unpredictable.

Bottom line is, any command that I only want to run once, I precede with a "chan 1"

Hope this helps

Phil

__________________

Designer Of GameCommanderPro - www.GameCommanderPro.com
Designer Of KeyBlaster - www.keyblaster.com

VonHenry
VonHenry's picture
User offline. Last seen 2 years 20 hours ago. Offline
Joined: 11/20/2009
Posts: 45
Ah - implementation details/decisions

Got it.


/* for 1 to 5....*/
<<All>>

/* set the leader*/
Macro /assist %$Leader%

/* now just one time, no need to run set 5 times... */
Chan 1

/* Save off the toon we want to loot*/
Set Toon,%SaveToon%
if %Toon% > 5

/* ah, everyone interact */
<<All>>
Hit -

/* ensure we just evaluate the conditional 1 time */
Chan 1
else

Thanks. Helps a lot.