Getting Snazzy with Initiative

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Ren
Kobold
Posts: 2
Joined: Sun Oct 12, 2014 7:25 pm

Getting Snazzy with Initiative

Post by Ren »

Hey guys, first post ever here, and I'm a long-time Maptool GM working for the first time on actually making campaign macros for my game. I'm not going buck wild as of now, but I am working on an Initiative announcer, and it's pretty good so far. I cobbled it together using some stuff I found via google, here's what it looks like.

Code: Select all

/emit
<hr />
[h: jsonInit = getInitiativeList() ]
[H: ThisChar = nextInitiative() ]
[H: AllTokens = json.get(jsonInit, "tokens")]
[H: YourUP = json.get(json.get(AllTokens, ThisChar), "tokenId")]
<!-- [Init1 = "acts"]
     [Init2 = "takes the initiative"]
     [Init3 = "makes a move"]
     [Init4 = "seizes the moment"]
     [Init5 = "rolls the dice"]
     [Init6 = "has a chance"]
     [Init7 = "is up"]
     [Init8 = "goes for it"]
     [Num = 1d8]
     [VariableName = "Init" + Num]
     [TheInit = eval(VariableName)]
-->
<b><i>Round [r: getInitiativeRound()]: {getName(YourUP)} {TheInit}!</i></b>
<hr />


So basically. Assuming everyone's initiatives are in game, whenever I click the button, the initiative advances forward and a neat little message appears that (let's say the next guy up is called "Jack") says something like "Jack is up!" or "Jack seizes the moment!"

Pretty neat and it works fine as is, but I've hit a snag.

I want the random messages that appear to not be so gender neutral, so instead of it being "Jack makes of move!" it'll say "Jack makes his move!" or, if we're on Jill, it'll say "Jill makes her move!"

I've already made a GM only token property called "Gender" (with the input being his or her, respectively, or I can go 0 or 1 with 1 meaning male.

So what I'm trying to do here is make the random messages change slightly depending on the gender of the current PC. How would I go about making that if() statement?

Also is there a way to make it so it won't display a message for NPCs if I click the button?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Getting Snazzy with Initiative

Post by wolph42 »

Code: Select all

[h: jsonInit    = getInitiativeList() ]
[H: ThisChar    = nextInitiative() ]
[H: AllTokens    = json.get(jsonInit, "tokens")]
[H: YourUP        = json.get(json.get(AllTokens, ThisChar), "tokenId")]
[h: name        = getName(YourUP)]
[h: gender        = getProperty("gender", YourUp)]
[h: round        = getInitiativeRound()]]

<!-- REMOVE THIS LINE BEFORE USE: using %{name} has the advantage that it can be placed anywhere, instead of the beginning only -->
<!-- make sure that all lists have the same length -->
[h: speechListNeutral    = "<b>%{name}</b> acts, %{name} takes the initiative, %{name} makes a move, %{name} seizes the moment, %{name} rolls the dice, %{name} has a chance, %{name} is up, %{name} goes for it"]
[h: speechListGender    = "<b>%{name}</b> makes %{gender} move, <b>%{name}</b>...etc."]

[r,if(isPC(YourUP)), CODE:{
    <!-- listGets first entry is 0, second is 1, etc. -->
    [h:message = listGet(speechListGender, 1d8 - 1)]
    [r:strformat("<br><b>Round: %{round}</b>." + message + "<br>")]
};{}]

<!-- OR (my personal favourite) -->

[h,if(isPC(YourUP)), CODE:{
    <!-- listGets first entry is 0, second is 1, etc. -->
    [message = listGet(speechListGender, 1d8 - 1)]
    [broadcast(strformat("<br><b>Round: %{round}</b>." + message + "<br>"))]
};{}] 

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Getting Snazzy with Initiative

Post by Irrlicht »

If all that changes in the messages are the pronouns, you could also go smoothly with a basic:

Code: Select all

[h, if(gender == "Female"), code: {
   [message = replace(message, " his ", " her ")]
   [message = replace(message, " him ", " her ")]
   [message = replace(message, " he ", " she ")]
}]
As long as it's english, it's easy... it's when you're dealing with other languages with many genderized words (like french, italian, spanish, etc.) that it becomes Hell.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

Ren
Kobold
Posts: 2
Joined: Sun Oct 12, 2014 7:25 pm

Re: Getting Snazzy with Initiative

Post by Ren »

Awesome, thanks guys. I'll keep you posted if any other issues come up.

Post Reply

Return to “Macros”