Macros and Changing Token Properties(Short term proposal)

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
Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Macros and Changing Token Properties(Short term proposal)

Post by Craig »

Hello,
I have been poking trough the MapTools source which of course led to tinkering, and in my tinkering I created a command /settokenproperty (or /stp for people like myself who dislike typing).

So far its pretty boring and can only set static values on selected tokens, e.g.
/stp HP 10
Which is if I am to be honest not that useful at all, so I started trying to figure out how to make it a little more dynamic (and still working on Java 5).

It then occurred to me that I could modify the settokenproperties command to use the dice roller using the familiar [] syntax (read on before calling me crazy :) ).

Say you wanted to apply damage to a token or set of tokens,
create a macro with
/stp HP "[HP - Damage]"
Assuming that the token(s) have the HP property (if not why are you trying to set it?) you should be prompted (once each run of the command, no matter how many tokens are selected) for "Damage" and have the HP property = HP - Damage

Using DnD 4e with Temporary Hit Points? no problem, assuming the property is TempHP you could make this macro
/stp TempHP "[TempHP - Damage]"
/stp HP "[HP + min(TempHP, 0)] "
/stp TempHP "[max(TempHP, 0)]"


Using DnD 4e and your mage loves firing fireballs at monsters with fire resistance? Well that can be done too! Assuming Fire resistance value is
in FireRes
/stp TempHP "[TempHP + min(0,FireRes - Damage)]"
/stp HP "[HP + min(TempHP, 0)] "
/stp TempHP "[max(TempHP, 0)]"
(In my defense I said you can do it, I never said it was either elegant or straight forward!)

Since it would use the standard dice roller I guess you could even make a macro to roll the ability scores for adhoc NPCs.

What it wont be able to do is make decisions (i.e if toHit > AC HP = HP - Damage) or refer to any other variables outside of the token being modified.

What I would like to know before I start continue down this path is would people find this useful? Would this be an acceptable short term alternative to scripting? I am also open to other suggestions or additions to the proposal

Craig

User avatar
Ryss
Dragon
Posts: 426
Joined: Sun Jun 15, 2008 1:12 pm

Post by Ryss »

My only reservation would be that when the true scripting support arrives, whatever you've done till that point would go to waste. Other than that, any sort of dynamic stuff is better than none I'd say :wink:

Welcome BTW :)

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Post by Phergus »

Is it restricted to only tokens that the user owns?

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

Post by Craig »

Phergus wrote:Is it restricted to only tokens that the user owns?
Yes, it is restricted to tokens that the user owns (the obvious exception
being for the GM), as I am sure the GM doesn't want to find out all the monsters suddenly have 0 HP even though no one has attacked them yet (or the Cthulhu token has opted for a name change to Candi for that matter) due to devious players.

User avatar
brad
Great Wyrm
Posts: 1233
Joined: Fri Apr 27, 2007 10:27 pm
Location: NY
Contact:

Post by brad »

Ryss wrote:My only reservation would be that when the true scripting support arrives, whatever you've done till that point would go to waste. Other than that, any sort of dynamic stuff is better than none I'd say :wink:

Welcome BTW :)
I don't think it would goto waste. If you look the Wall of Features, "Macros set token properties" is not far down the list. Craig, I would encourage you to talk to trevor about maybe putting your efforts towards that end.

Yes, scripting will eventually be coming and it will be able to do all this stuff. But, properties and "macros setting token properties" could do a lot of the things that people want and it is much more simple. I know that many of the people on these forums have a little(or a lot of) coding experience, so scripting is what they are looking for, because of all of the possibilities it opens up. However, I am betting that there are a whole lot more normal users that hear that scripting is needed for certain features and just want to run. Properties and "macros setting token properties" are a nice middle ground that greatly decreases the learning curve.

So, Craig if you are thinking about taking this on, please, please do. I have been waiting for this one )and contributing to it on the Wall of Features) for a while now. Talk to trevor about what he is looking for in "macros set token properties".
View MapTool video tutorials at RPToolsTutorials.net

User avatar
kat2cute
Dragon
Posts: 297
Joined: Wed Jan 30, 2008 3:46 pm

Post by kat2cute »

It would be an awesome interim solution, as I'm pretty sure even partial scripting support for this sort of thing won't be implemented till 1.4, which will take a lot longer to get out then the tweaks to the existing 1.3 updates that we've been getting.
Would this be a chat-only ability? I could see
/stp HP "[HP - Damage]"
being useful, especially if we can just program that into a global macro button and select the tokens we want to Damage. You would definitely have to explain the syntax some more. But as long as it works in the chat window, we can program it directly into a button and the length(aka; non-elegance) of the syntax shouldn't be a major issue. It is definitely a worthwhile endeavor which i have been waiting for from the Wall of Features for a while.
Quote from an underwater D&D fight:
Alright fighter, it's your turn. What do you do?
Fighter: What do you think I do? I FAIL MY F**KING SWIM CHECK

User avatar
Ryss
Dragon
Posts: 426
Joined: Sun Jun 15, 2008 1:12 pm

Post by Ryss »

Just a clarification: By "going to waste" what I meant was the code. Clearly when there is scripting, we won't need this interim solution and it has to be discarded to keep the code clutter free. But the upside is we would have "pseudo-scripting" right away. And I can imagine that a lot of people will like this.

So I second brad on all points. If Craig is willing to take on this job, hell, why not?

Besides scripting doesn't seem to be coming soon, sadly. There are other stuff higher on our todo lists.

User avatar
wrathchild
Dragon
Posts: 546
Joined: Thu May 24, 2007 9:44 am
Location: Copenhagen, Denmark
Contact:

Post by wrathchild »

Oh, plz submit something like this

plzplzplzplzplzplzplzplzplzplz
Entering the Digital Age of Roleplaying.
Part of the Resident GURPS Lobby.
Calling for Halos to be Hexified.

User avatar
UntoldGlory
Great Wyrm
Posts: 1649
Joined: Sun Mar 16, 2008 8:12 pm

Post by UntoldGlory »

Plz can i haz? I giv cookie!



Seriously though, I'm digging all these new useres popping up with contributions!


Heh, I say that as though I've been here for years instead of a couple of months...

User avatar
RedDog
Dragon
Posts: 393
Joined: Sat Jan 05, 2008 10:02 pm
Location: Clearwater, FL

Post by RedDog »

Absolutely! For HP alone it would be great!

I would suggest following the /tmacro format and start it with /tXXXX for the command though. Also, why not use a standard algebraic format like [HP = HP -10]?

Even if you just did a bare bones command that allowed you to just replace a numeric or text value, it would be so useful.

User avatar
rdarsque
Kobold
Posts: 11
Joined: Sun Jun 22, 2008 12:12 pm

Post by rdarsque »

Now this would be very awesome even if just for the interim or it could be kept on for just simple string/variable changes that people don't want to script for in later developments.

I would really like to see this happen to save on many click/edit/change ad infinitum... process that I am and probably many others are having to do with encounters designed for 5-8 parties right now.

8)

User avatar
UntoldGlory
Great Wyrm
Posts: 1649
Joined: Sun Mar 16, 2008 8:12 pm

Post by UntoldGlory »

Iiiiiiiiiiiiiindeed.


The ability to add a buttom macro for altering HP, and possibly changing MiscAttBonus and MiscDamageBonus would be more than awesome. I can wait on the scripting to be able to hit the "Short Rest" button or whatnot.

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

Post by Orchard »

Craig, I support your decision to take a role in this. Personally, I think scripting is a cool way to go, but many people don't code, and so a pseudo script like what you are describing is more practical for their needs. I say go for it, and we can absolutely use this.
0+0=1, for very unstable CPUs.

User avatar
kat2cute
Dragon
Posts: 297
Joined: Wed Jan 30, 2008 3:46 pm

Post by kat2cute »

Did set token Property (/stp) ever get queued to add to the next build? I saw set token state (/sts) got added in b33, and that's pretty cool, but I was really looking forward to /stp. Is this still in the works?
Quote from an underwater D&D fight:
Alright fighter, it's your turn. What do you do?
Fighter: What do you think I do? I FAIL MY F**KING SWIM CHECK

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

Post by Craig »

I have sent a patch for /settokenproperty (/stp). I don't know what build it will make it into as I am sure trevor would like to stop adding features to 1.3 so he can get it out the door and start on 1.4 :)

The short version on how to use it
/stp [PropertyName = value]
It can also be used to set token states
/stp [state_StateName = value]
value can be "false" or 0 to turn off state, "true" or non zero to turn it on

Also halos
/stp [token_halo=Color]
Color can be one of the colors in the popup menu (e.g. "Red", "Green") or a hexadecimal proceeded by a #value for a custom halo (e.g. "#AABBCC" Red = AA, Blue = BB, Green = GG)


Some completely made up examples, for the below examples Damage is not a token property
and has no value assigned to it so would be prompted

Take damage away from HP
/stp [HP = HP - Damage]

Take fire damage away and set on fire state
/stp [HP = HP - max((Damage - FireRes),0)] [state_OnFire = "true"]
or if using a red halo to signify on fire
/stp [HP = HP - max((Damage - FireRes),0)] [token_halo = "Red"]

Thats the short version I am currently on a very slow dial up connection
and the more detailed version dies when I try to post it. I will hopefully be able to post it in the next day or two

Post Reply

Return to “MapTool”