Page 1 of 1

HOWTO: Flagtoon - What is it, and how to use it

PostPosted: 06 May 2022, 10:29
by Kannkor
What is FlagToon?
Many times in the game, a specific task must be completed, some times multiple tasks. For this, I use the name "Flagtoon" to designate flags. These are generic numeric numbers, but with meaning to each time they are used. There are 24 flags, 1-24.
Generally speaking, I always use them starting at 1, and work my way up as I need more than 1 during a specific situation.

Example:
There's a situation (likely an encounter, but doesn't really matter), where there's two objects, say, a dragon statue, and a cow statue. They both need to be clicked, but by different people. The question is, who do we assign to each of them? There's lots of solutions for this, it can be random, could be the first two people in the group. Lets add some more to make this a bit more difficult.
Add in, it cannot be a fighter, because if the named goes close to these statues, you fail. While there's still lots of solutions, the two I use most often, are "hard coding to have a bard and enchanter do it", or more recently, lets flag some toons to do the work.
The benefit to flagging toons, is inside of a SetUpFor, I can auto-flag the bard and enchanter, but you, the user, can change these flags after the SetUpFor, but before you engage. Maybe you don't have a bard, so you use a priest in his spot.
In our scenario, we're going to say Flag 1 is for doing the dragon statue, and flag 2 is for doing the cow statue.
We tell our bard "hey, you do flag 1 stuff"
We tell our enchanter "hey, you do flag 2 stuff"
Now they understand what their roles are, and will complete the tasks set out for them.
Anyone else who isn't assigned flag 1 or 2, won't do anything.


More Information on flags
Flags are completely independent of each other. So it's completely acceptable that someone could be flagged for both flags 1 and 2 (or all 24). For some situations, like the one above where it has to be different people, this would not work. However from a straight code point of view, there are times where it is the same person, and that's fine.
Example: If you're familiar with Merchant's Den 2, the 3rd named, Gelda, the "Bubble" mob, it has two major components. Dispelling adds, and running around doing bubbles, then dispelling the named after. These are designated by Flag 1 and Flag 2. If you have 2 mages, such as a warlock and enchanter, you may want to split the work load, making the enchanter flag 1 and the warlock flag 2. However, if you only have 1 mage, you can designate the mage to do both jobs, giving them both flag 1 and flag 2.

Flags are completely independent for each character, and each character has no knowledge of someone else's flag.
You can have multiple people be a flag 1, if the situation needs it. Take for example, a situation where 50% of the group needs to go North, and 50% of the group needs to go South. You could flag 1 three characters, such as the fighter, bard, and priest, then flag 2 the other three, such as the enchanter, priest2, and dps. This way you have a priest on both sides.
Take the situation above, where we have flagged three characters with flag 1 and three with flag 2. Each character does not know that other people are flagged, and nor do they really care. They just know THEY are flagged.

Basic usage of flags
For the newest content, flags are usually automatically assigned using SetUpFor. For older content, you may need to assign a flag.
In the situation where you want to change a flag, this is how you do all of this.
MCP -> FlagToon
Image
Code: Select all
Obj_OgreMCP:PasteButton[FlagToon,Flg_Brd,bard,1]

This will flag 1 a bard.
Likewise, we can flag 2 our enchanter and flag 3 @Healer1 (@Healer1 is a designation for the first priest in your group, by a predetermined order).
Image
Code: Select all
Obj_OgreMCP:PasteButton[OgreConsoleCommand,AddFlags,-FlagToon,Enchanter,2,-FlagToon,@Healer1,3]


For the scenario of we want to change a flag, say, we want only a character named "Kannkor" to have flag 1, but our bard already has flag 1. We need to remove the bard. We have two options, we can specifically remove the bards flag 1.
Image
Code: Select all
Obj_OgreMCP:PasteButton[UnFlagToon,UnFlg_Brd,bard,1]


Or to be sure, we make sure NO ONE has a flag 1, then we add in our flag for "Kannkor".
Image
Code: Select all
Obj_OgreMCP:PasteButton[UnFlagToon,UnFlg_all,all,1]


Then we flag "Kannkor". This is done the same as above for the bard, except use "Kannkor" instead of "bard".
You can, of course, do this all in 1 button, if you wish.
In this example, we remove Flag 1 from everyone, then apply Flag 1 to the character pressing the MCP button (${Me.Name} means the character pressing the button)
Image
Code: Select all
Obj_OgreMCP:PasteButton[OgreConsoleCommand,Flag1Me,-UnFlagToon,all,1,-FlagToon,\${Me.Name},1]


And lastly, lets say we want to clean up all flags. We can do that also.
Image
Code: Select all
Obj_OgreMCP:PasteButton[UnflagAll,UnflagAll,all]


Using Flags in code
Okay, so you want to get all fancy dancy here and use the flagging system in code. This is all done via OgreBotAPI. Keep in mind, OgreBotAPI is for the local session only. If you need to send information across sessions, use OgreConsole (If you're at this stage, you should already know that).

Parameters are: ForWho,Flag#
Code: Select all
OgreBotAPI:FlagToon["all",1]
OgreBotAPI:UnflagToon["all",1]

Parameter is ForWho
Code: Select all
OgreBotAPI:UnflagAll["all"]

Parameter is Flag#
Code: Select all
echo ${OgreBotAPI.ToonFlagged[1]}

Returns TRUE (if flagged) or FALSE (if not flagged) for the Flag#

ForWho understands the flagging system too.
Code: Select all
echo ${OgreBotAPI.CommandForMe["ToonFlagged:4"]}

Note: It's ToonFlagged:#, where # is the Flag# from 1 to 24
Code: Select all
oc !c -pause "ToonFlagged:2"

Would pause anyone with Flag Toon 2