Using the initiative Panel (b41)

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
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Using the initiative Panel (b41)

Post by Orchard »

first off:

WOOT!

Second:

WOOOOOO!

Okay, that's out of the way. Now what?

I want to use some of the functions, but I don't know how.

Code: Select all

[setInitiative(Hero, 1d20)]
returns:

Code: Select all

Could not execute the command: Undefined function: setInitiative
uh....that's not good.

So now what? Where do I go from here? Halp? plz.
0+0=1, for very unstable CPUs.

Krattack
Kobold
Posts: 18
Joined: Tue Aug 19, 2008 11:01 am
Location: Tampere, Finland

Post by Krattack »

I just tested making a macro that rolls initiative for a token and adds that token to the initiative list if it not on it already and this is what I came up with:

Code: Select all

[P:token.name] has initiative of [Init = 1d20 + Bonus]
[H:addToInitiative(0,Init)]
EDIT: BTW, the macro needs to be a token macro.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

That works for some tokens, but not when there are tokens with the same player name...
0+0=1, for very unstable CPUs.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

To whit--if you have multiple tokens with the same player name, and do this as you have suggested, it ONLY updates the first one added to the board, even if you have the token on the board multiple times.

If anyone can figure out a way around this, I'd appreciate it.

(Test it BEFORE you post. Add a token. Copy and paste several copies, then add the macro to all of them. Play with the behavior until you understand what is happening, then if you can figure out a way around it, let me know. It's NOT a bug, but having both options is a good idea.)
0+0=1, for very unstable CPUs.

Krattack
Kobold
Posts: 18
Joined: Tue Aug 19, 2008 11:01 am
Location: Tampere, Finland

Post by Krattack »

Orchard wrote:To whit--if you have multiple tokens with the same player name, and do this as you have suggested, it ONLY updates the first one added to the board, even if you have the token on the board multiple times.

If anyone can figure out a way around this, I'd appreciate it.

(Test it BEFORE you post. Add a token. Copy and paste several copies, then add the macro to all of them. Play with the behavior until you understand what is happening, then if you can figure out a way around it, let me know. It's NOT a bug, but having both options is a good idea.)
Well, color me surprised. It seems that they need to have unique player names if the tokens in the init list represent different tokens on the map. Not even different GM name is sufficient... The functions update all instances of same token on the init list ok, but not if there are several tokens with same name. I will fiddle with it some more to see if I can come up with a solution.

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Re: Using the initiative Panel (b41)

Post by jay »

Orchard wrote:first off:

WOOT!

Second:

WOOOOOO!

Okay, that's out of the way. Now what?

I want to use some of the functions, but I don't know how.

Code: Select all

[setInitiative(Hero, 1d20)]
returns:

Code: Select all

Could not execute the command: Undefined function: setInitiative
uh....that's not good.

So now what? Where do I go from here? Halp? plz.
The command doesn't take a token name. You have to execute it in a token context (token macro, etc.). There is support for getting the token using a different function, but it doesn't appear to be turned on in the macro support code yet.

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Post by jay »

Krattack wrote:Well, color me surprised. It seems that they need to have unique player names if the tokens in the init list represent different tokens on the map. Not even different GM name is sufficient... The functions update all instances of same token on the init list ok, but not if there are several tokens with same name. I will fiddle with it some more to see if I can come up with a solution.
The token names don't have anything to do with the initiative panel functions. They are only displayed to the player or GM on the panel. Since the addToInitiative() is a token function it only works on the current token. Different tokens, regardless of their name, are never modified.

bobthedog
Cave Troll
Posts: 85
Joined: Sun Aug 03, 2008 7:17 pm

Post by bobthedog »

Orchard wrote:To whit--if you have multiple tokens with the same player name, and do this as you have suggested, it ONLY updates the first one added to the board, even if you have the token on the board multiple times.

If anyone can figure out a way around this, I'd appreciate it.

(Test it BEFORE you post. Add a token. Copy and paste several copies, then add the macro to all of them. Play with the behavior until you understand what is happening, then if you can figure out a way around it, let me know. It's NOT a bug, but having both options is a good idea.)
Changing the code above to "addToInitiative(1, Init)" should work.

That 0 means it won't allow duplicates. Changing it to 1 makes it allow them...

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

jay wrote:
Krattack wrote:Well, color me surprised. It seems that they need to have unique player names if the tokens in the init list represent different tokens on the map. Not even different GM name is sufficient... The functions update all instances of same token on the init list ok, but not if there are several tokens with same name. I will fiddle with it some more to see if I can come up with a solution.
The token names don't have anything to do with the initiative panel functions. They are only displayed to the player or GM on the panel. Since the addToInitiative() is a token function it only works on the current token. Different tokens, regardless of their name, are never modified.
This isn't quite right...

Jay, what I'm saying is that if I add a token, copy and paste it around, then use a macro to set it's initiative, it is conceptually (to me) a different monster, but the panel is treating it as if it isn't, and won't let me set the init for any but the first token.

Let me take my example further.

I take token1 onto the map, name it 'Dragon'.

I take token2 onto the map, name it 'Dragon' as well.

Why would I do this? Well, who knows. But this is illustration. If, as you say, the name is irrelevant, then the behavior I am seeing is impossible.

Because when I run this macro:

Code: Select all

[P:token.name] has initiative of [Init = 1d20] 
[H:setInitiative(Init)]
as a token macro on token2, which is NOT in the init panel, (but token1 is), then the initiative for token1 is changed/set. This is a bug.

There's no way around that.
0+0=1, for very unstable CPUs.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

bobthedog wrote:
Orchard wrote:To whit--if you have multiple tokens with the same player name, and do this as you have suggested, it ONLY updates the first one added to the board, even if you have the token on the board multiple times.

If anyone can figure out a way around this, I'd appreciate it.

(Test it BEFORE you post. Add a token. Copy and paste several copies, then add the macro to all of them. Play with the behavior until you understand what is happening, then if you can figure out a way around it, let me know. It's NOT a bug, but having both options is a good idea.)
Changing the code above to "addToInitiative(1, Init)" should work.

That 0 means it won't allow duplicates. Changing it to 1 makes it allow them...
Doesn't explain my problem with setInitiative....
0+0=1, for very unstable CPUs.

Krattack
Kobold
Posts: 18
Joined: Tue Aug 19, 2008 11:01 am
Location: Tampere, Finland

Post by Krattack »

jay wrote:
Krattack wrote:Well, color me surprised. It seems that they need to have unique player names if the tokens in the init list represent different tokens on the map. Not even different GM name is sufficient... The functions update all instances of same token on the init list ok, but not if there are several tokens with same name. I will fiddle with it some more to see if I can come up with a solution.
The token names don't have anything to do with the initiative panel functions. They are only displayed to the player or GM on the panel. Since the addToInitiative() is a token function it only works on the current token. Different tokens, regardless of their name, are never modified.
Sorry, but it appears they do. If you do it like Orchard said (drop a token on the map, copy-paste it a few times from the token on the map, copy the init macro to all of the tokens, add all of them to the init list) then when you run the init macro on any of them the init always goes to the original token. I don't really know if it has anything to do with names, but that's the way it looks like right now. You can even rename a token so it has the same name as some other token and when you run the init macro on the renamed one and it will update the init to the other token.

About the only workaround I can think of right now is to drag'n'drop all the needed copies either from resource window or external image/token. Which automatically gives all the tokens an unique name.

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Post by jay »

Krattack wrote:
jay wrote:
Krattack wrote:Well, color me surprised. It seems that they need to have unique player names if the tokens in the init list represent different tokens on the map. Not even different GM name is sufficient... The functions update all instances of same token on the init list ok, but not if there are several tokens with same name. I will fiddle with it some more to see if I can come up with a solution.
The token names don't have anything to do with the initiative panel functions. They are only displayed to the player or GM on the panel. Since the addToInitiative() is a token function it only works on the current token. Different tokens, regardless of their name, are never modified.
Sorry, but it appears they do. If you do it like Orchard said (drop a token on the map, copy-paste it a few times from the token on the map, copy the init macro to all of the tokens, add all of them to the init list) then when you run the init macro on any of them the init always goes to the original token. I don't really know if it has anything to do with names, but that's the way it looks like right now. You can even rename a token so it has the same name as some other token and when you run the init macro on the renamed one and it will update the init to the other token.
It appears that the code that sets the token in the macro context does the work by name. This has nothing to do with the initiative functions. You can see this by using a macro to set the token name: [token.name = 'Bug!'].
Krattack wrote:About the only workaround I can think of right now is to drag'n'drop all the needed copies either from resource window or external image/token. Which automatically gives all the tokens an unique name.
I get unique names when I cut and paste as well. That was the reason I didn't see the bug earlier.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

jay wrote:
Krattack wrote:
jay wrote:The token names don't have anything to do with the initiative panel functions. They are only displayed to the player or GM on the panel. Since the addToInitiative() is a token function it only works on the current token. Different tokens, regardless of their name, are never modified.
Sorry, but it appears they do. If you do it like Orchard said (drop a token on the map, copy-paste it a few times from the token on the map, copy the init macro to all of the tokens, add all of them to the init list) then when you run the init macro on any of them the init always goes to the original token. I don't really know if it has anything to do with names, but that's the way it looks like right now. You can even rename a token so it has the same name as some other token and when you run the init macro on the renamed one and it will update the init to the other token.
It appears that the code that sets the token in the macro context does the work by name. This has nothing to do with the initiative functions. You can see this by using a macro to set the token name: [token.name = 'Bug!'].
Krattack wrote:About the only workaround I can think of right now is to drag'n'drop all the needed copies either from resource window or external image/token. Which automatically gives all the tokens an unique name.
I get unique names when I cut and paste as well. That was the reason I didn't see the bug earlier.
Ah, it's a preferences thing...

but the default is to show numbering on GM_Name, not the playername, which makes a big difference.

I'll switch to that for now, but I do think it should be resolved at some point. I'd fix it if I knew how...

..which I don't.
0+0=1, for very unstable CPUs.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Post by Full Bleed »

A couple questions:

1) I take it there is no way I can run [h:sortInitiative()] without sending a blank to the Chat window?

2) When running the token.init function is there some way to avoid it spitting data to the chat window too? I'd much rather it just update the init window and not scroll up more important information in the chat window.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Post by RPTroll »

You could print something to chat saying you are sorting initiative. That way the players would know.

Post Reply

Return to “MapTool”