Initiative Output Markup

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Initiative Output Markup

Post by nolgroth »

Is it possible to markup the text sent whenever a character receives initiative? Mostly I want to bold it so it stands out or perhaps change the color. Thanks in advance.

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

Re: Initiative Output Markup

Post by wolph42 »

nolgroth wrote:Is it possible to markup the text sent whenever a character receives initiative? Mostly I want to bold it so it stands out or perhaps change the color. Thanks in advance.
yes.
1. turn the message of in the settings
2.check the wiki for the initiative functions (cause you'll need to write your own)
3.when you've done that create a macro which ends with

Code: Select all

[r:token.name] receives initiative
You can give that line any html make up you want.

The most simple variant would be e.g:

Code: Select all

[h:nextInitiative()]
<b>[r:token.name] receives initiative</b>.
 
and ofcourse if you wish to add colours depending on the e.g. the name of the token... you'll need to add Wiki: if() or [switch:] functions.

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Initiative Output Markup

Post by nolgroth »

Now I feel stupid. Thanks for that insightful post. I plum forgot about using macros to advance the initiative list. Now all I have to do is decide if it is worth the time or not.

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Initiative Output Markup

Post by JonathanTheBlack »

Roll Initiative

Code: Select all

[h, if(getInitiative() != "The token is not in the initiative list."): assert(0, "<b style='color: #660000;'>" + token.name + " is already in combat!</b>", 0)]
[h: addToInitiative()]
[h: setInitiative(1d20 + InitiativeBonus + Level)]
[h: sortInitiative()]
[h: abort(0)]
End Turn

Code: Select all

[h, if(isGM()), CODE:
  {
    [h: setState("Initiative", 0, getInitiativeToken())]  
    [h: nextInitiative()]
    [h: setState("Initiative", 1, getInitiativeToken())]
  };{
    [h: Self = currentToken()]
    [h: HasInit = getInitiativeToken()]
    [h: assert(if(Self != HasInit, 0, 1), "<b style='font-color: #660000'>You do not have initiative.</b>", 0)]
    [h: setState("Initiative", 0, getInitiativeToken())]  
    [h: nextInitiative()]
    [h: setState("Initiative", 1, getInitiativeToken())]    
  }]
  [h: abort(0)]
End Combat (Narrator Only)

Code: Select all

[h, if(isGM()), CODE:
  {
    [status = input("EndCombat | 0 | Are you sure you want to end combat | CHECK")]
    [abort(status)]
    [assert(EndCombat)]
    [setState("Initiative", 0, getInitiativeToken())]  
    [removeAllFromInitiative()]
  };{
    [assert(0, "<b style='color: #660000;'>You are not the GM.</b>", 0)]
  }]
Attachments
initiative.png
initiative.png (9.06 KiB) Viewed 1143 times

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Initiative Output Markup

Post by JonathanTheBlack »

I had another version that tracked combat with a variable on the lib token and wouldn't allow anyone to use a rest macro until after combat was over, but my mom deleted it from her laptop. >_<

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Initiative Output Markup

Post by nolgroth »

Those are great examples. I will have to use those to adapt my Hero System framework. I already have it doing most of the stuff I need it to. The only thing I would like is the markup at this point. I think, between you and Wolph, that I am well on the way. Thanks for your response.

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Initiative Output Markup

Post by JonathanTheBlack »

I blatantly stole the idea from Rumble for the state marking whose turn it is.

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

Re: Initiative Output Markup

Post by wolph42 »

JonathanTheBlack wrote:I blatantly stole the idea from Rumble for the state marking whose turn it is.
using it too and have improved it by sending a broadcast to the initiative receiver, which centers and selects his/her token on his/her pc.

User avatar
JonathanTheBlack
Dragon
Posts: 544
Joined: Mon Jun 28, 2010 12:12 pm
Location: I'm the worm...

Re: Initiative Output Markup

Post by JonathanTheBlack »

I thought about doing that, but I dislike taking control of other's screens. However, if there was one person constantly not noticing, I could probably cobble something together that just does it for them and not others.


User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Initiative Output Markup

Post by Azhrei »

The chat messages are part of the localized text file that MapTool uses. So there's one for English, one for Spanish, and so on. You could edit the English one and change the message to contain whatever HTML you wanted it to contain, but using an executable macro is much more flexible of course!

There's a thread in this forum (I think) which talks about how to add a new language translation for MT. It describes how to extract the file and makes changes.

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Initiative Output Markup

Post by nolgroth »

Okay, I have a follow up question (and the advice I have thus far received has worked great). In HERO, there are states such as Abort and Stunned which effectively remove a person from the initiative for that Segment. I have everything working that does that. It outputs a message and removes an affected token from the list. The problem is, the nextInitiative() command still outputs to chat. Is there a way to suppress that output so that only if the person is NOT affected by those states, it outputs the message? It seems to only do that for the first person in the initiative table.

Here is the code snippet for reference.

Code: Select all

[h: nextInitiative ()]	<!--THIS IS THE CULPRIT I THINK-->
[h: tokID = getInitiativeToken()]
[h: switchToken (tokID)]
[h: name=getName (tokID)]
[h: holdStatus=getState ("hold", tokID)]
[h: abortStatus=getState ("abort", tokID)]
[if (abortStatus==1), CODE: 
		{
		[h: setState ("abort", 0, tokID)]
		[h: setState ("dodge", 0, tokID)]
		[r: abortMsg=""+name+" Recovers from Aborting"]
		[h: removeFromInitiative ()]
		};
		{
		[h: abortMsg=""]
		}
	]

[h: stunnedStatus=getState ("stunned", tokID)]
[if (stunnedStatus==1), CODE: 
		{
		[h: setState ("stunned", 0, tokID)]
		[r: stunnedMsg=""+name+"Recovers from being Stunned"]
		[h: removeFromInitiative ()]
		};
		{
		[h: stunnedMsg=""]
		}]
	
[if (holdStatus==1), CODE: 
		{
		[r: holdMsg=""+name+" was Holding but it is their Phase. Hold canceled ."]
		[h: setState ("hold", 0, tokID)] 
		};
		{
		[h: holdMsg=""]
		}
	]
	
[r, if (abortStatus==0 && stunnedStatus==0): "<b>"+name+" receives initiative</b>."]

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Initiative Output Markup

Post by nolgroth »

Scratch last request. I was able to get around that little detail by setting a couple of campaign properties (currentInit and numInitTokens) onto the Lib:Combat token. From there I set it up to manually set the number of tokens and start the first initiative at offset 0. From there the macro sets the currentInit to currentInit+1. Finally, once the currentInit equals the numInitToken-1, it outputs an error message and clears the initiative table. If you read my previous message, thanks for taking the time to do so and for any possible responses/solutions you may have considered. Got this one handled for now I think.

EDIT: Or not. It seems that Offset 0 always outputs the standard "(token) has received Initiative" message. I think I may well have to go into the guts, as was previously suggested, and remove that output text completely.

EDIT II: Well that worked sort of. By blanking out the init panel message, it gets rid of the "{0} receives initiative" message, but it leaves a blank line in the chat. Better that than the other though. I added a generic message instead. Of course, this won't help anybody downloading the campaign framework for their own use.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Initiative Output Markup

Post by aliasmask »

The "Show Initiative Gain Message" option is a personal preference and only displays for PCs. You can ask all the players to turn it off if they only want to see your message. I wrote an initiative macro for firefly and shadow run, which has it's own complications which requires a lot of re-sorting. Before I sort, I set the Wiki: setCurrentInitiative() to -1, so I don't get any extra "X has gained initiative" message. At the end, I set the initiative to the correct position and gameplay continues.

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Initiative Output Markup

Post by nolgroth »

Man I really can be such an idiot at times. I almost never hit that tab on the Preferences section. Mostly I set the options on the Interactions and Accessibility tabs. Thanks for posting that aliasmask. Will save me a lot of trouble. Since I am on the topic, what does the "Fill Selection Box" under Performance do?

Tip: Don't replace the jar file with your backup while the program is running. Bad mojo ensues.

Post Reply

Return to “MapTool”