New functions (question)

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. :)
Post Reply
bobthedog
Cave Troll
Posts: 85
Joined: Sun Aug 03, 2008 7:17 pm

New functions (question)

Post by bobthedog »

Okay, so I decided to try out some of the new features in b40 (specifically, the new functions to set/get a bunch of token stuff). To start, I was going to make a Saving Throw (4e) macro, that would ask you for what you're saving against, and unset the state if you save successfully. Here's the code I came up with:

Code: Select all

<!--
[Cond = Effect]
[Save = 1d20+MiscSaveBonus]
[setState(Cond, if(Save >= 10, 0, 1))]
-->
<b>Saving Throw{if(Cond == "0", "", " vs. "+Cond)}: {Save}</b>


This code doesn't work. Well, it does, but the line that should unset the state just gives "invalid expression".

So I thought "hmm, maybe it doesn't work well with if clauses", and shifted stuff around. Still nothing. Then I tried changing caps all around the function.

Then I tried all the other functions listed in the announcement thread. None are working.

Any ideas?

Edit: stupid HTML

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

Post by bobthedog »

*bump*

So, no one else running into problems with the new functions?

knizia.fan
Giant
Posts: 197
Joined: Wed Jul 30, 2008 3:43 pm

Post by knizia.fan »

I don't seem able to make getState() and setState() work. However, the alternative syntax using state.Dead, state.Disabled, etc. does work, so you can get and set the states that way.

Other new functions like getTokenImage() and getStateImage() are working for me.

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

I can't help as I'm not running b40 (fearful of the campaign munching it's been reported to do).
A wandering lost soul

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

Post by bobthedog »

knizia.fan wrote:I don't seem able to make getState() and setState() work. However, the alternative syntax using state.Dead, state.Disabled, etc. does work, so you can get and set the states that way.

Other new functions like getTokenImage() and getStateImage() are working for me.


Yea, the "old" way still works (like state.Blah). My problem is assigning the state dynamically as part of the macro.

Like my example macro above: it prompts the user for a Condition. Then it rolls a save, and if the save succeeds, it toggles the equivalent state off.

So if there is a token state called Poison, and the macro rolls a save vs. poison, you don't need to unset the Poison state manually. Nor do you need one macro for each different token state.

knizia.fan
Giant
Posts: 197
Joined: Wed Jul 30, 2008 3:43 pm

Post by knizia.fan »

Until those functions start working, you can work around this with the eval function.

[eval("token." + stateName + "= 1")]

should work.

You said none of the new functions were working for you. Does that include getTokenImage() and getStateImage()? Those two work for me.

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

Post by bobthedog »

knizia.fan wrote:Until those functions start working, you can work around this with the eval function.

[eval("token." + stateName + "= 1")]

should work.

You said none of the new functions were working for you. Does that include getTokenImage() and getStateImage()? Those two work for me.


No time to test those two specific ones, but I did try getName() and setName() and some other ones. Once the 5th or 6th didn't work, I assumed none of them were working, since they're all the same "bundle".

Also, thanks for the workaround suggestion, when I have the time I'll test that. Oh, and it should read

[eval("state." +......

shouldn't it?

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Post by Craig »

Ok my fault my brain went MIA while typing patch notes to send to Trevor :oops:

The functions that work are
tblImage()
getGMName()/setGMName()
getHalo()/setHalo()
getTokenImage()
getStateImage()

I accidentally put an extra "Token" in some in the notes (getTokenGMName())

As for getState()/setState() I don't have any idea what happened with that one but you can probably blame me too :)

I have sent a patch to fix get/setState() to Trevor, but given he is probably currently building release 41 it may not make it into that.

Post Reply

Return to “MapTool”