eval(string()) works fine for me. You want to do the string() at the eval(); I don't think MTScript maintains the idea of a var being a string just because you did a string() somewhere earlier in the code.
[h:HP = eval(string(HP - hpChange))]
[h:HP = min(eval(string(HP+hpChange)), MaxHP)]
Search found 364 matches
- Tue May 14, 2019 6:48 am
- Forum: General Discussion
- Topic: Input and evaluate dice or numbers expressions
- Replies: 8
- Views: 1030
- Mon Apr 01, 2019 7:09 am
- Forum: MapTool
- Topic: Macros for Lighting
- Replies: 5
- Views: 621
Re: Macros for Lighting
I copied the code to a new campaign and changed it from "1e" to "D20" and it worked for me. So there must be some other issue at play.
- Sun Mar 31, 2019 1:33 am
- Forum: MapTool
- Topic: Macros for Lighting
- Replies: 5
- Views: 621
Re: Macros for Lighting
":" indicates the end of your roll options. "," separates roll options. So if I wanted to hide the output of an if I'd do [h,if():]. Which is also why your code doesn't work. Autoexecute runs the macro immediately. Otherwise it fills the macro command box. Apply to selected means...
- Thu Feb 28, 2019 12:47 am
- Forum: MapTool
- Topic: chat css vs dialog css
- Replies: 6
- Views: 641
Re: chat css vs dialog css
<table cellpadding=0 style="...
- Sat Feb 23, 2019 5:21 am
- Forum: Macros
- Topic: need help for HP macro
- Replies: 6
- Views: 706
Re: need help for HP macro
Not sure what you mean since the macro doesn't refer to token name.
- Tue Jan 29, 2019 12:13 am
- Forum: Macros
- Topic: Force Client SelectTokens Initiative Tool
- Replies: 3
- Views: 681
Re: Force Client SelectTokens Initiative Tool
You can make code execute on a client with macroLink().
- Mon Dec 31, 2018 5:48 am
- Forum: Macros
- Topic: Help request for simple macro [RESOLVED]
- Replies: 5
- Views: 478
Re: Help request for simple macro
The double quote in chat comes from unclosed [if:]. Always complete them.
[if(), code:
{
};{}]
[if(), code:
{
};{}]
- Fri Dec 21, 2018 11:13 am
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
Err, that's where you put your list of states that are used in the dialog. I don't know what they are.
- Fri Dec 21, 2018 6:28 am
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
[abort(isGM())] [sStatesOff="{list of states in dialog}"] [h:jStates=macro.args] [h:cHiddenstates=json.set("{}","Ethereal Form",1,"Hide",1,"Hide from Animals",1,"Hide from Undead",1,"Invisibility",1,"Invisibility Greater&quo...
- Thu Dec 20, 2018 10:11 pm
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
Typos. Which is what happens you change your mind about variable naming scheme in the middle of coding.
[jaStatesOn=json.fromList(sStates)]
[jaStatesOff=json.fromList(sStatesOff)]
[jaStatesOff=json.difference(jaStatesOff,jaStatesOn)]
[sStatesOff=json.toList(jaStatesOff)]
[jaStatesOn=json.fromList(sStates)]
[jaStatesOff=json.fromList(sStatesOff)]
[jaStatesOff=json.difference(jaStatesOff,jaStatesOn)]
[sStatesOff=json.toList(jaStatesOff)]
- Thu Dec 20, 2018 6:26 am
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
In ProcessState [sStatesOff="{list of states in dialog}"] [jaStatesOn=json.fromList(sStates)] [jaStatesOff=json.fromList(sOffstates)] [jaStatesOff=json.difference(jaOffStates,jaOnStates)] [sStatesOff=json.toList(jaStatesOff)] remove the SetAllStates(0) [h,foreach(sState,sStatesOff,"&q...
- Wed Dec 19, 2018 10:18 pm
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
Also, I just realized that if I am using a state on the token that does not appear in this macro, this macro removes the state and only uses the states that were selected via this macro. How can I tweak this? You need to make a list of the states that aren't in the dialog, record which ones are on....
- Wed Dec 19, 2018 5:29 am
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
I see some of my dodgy artwork has invaded another framework.
- Mon Dec 17, 2018 8:34 pm
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
Just to ask the obvious, is it possible that the state Hidden is defined with a Type other than Image? That would be it. If the campaign only contains your states and they're all image states you can just do getTokenStates(","). You'll have to make an exception for non-image states or exc...
- Mon Dec 17, 2018 5:53 am
- Forum: Macros
- Topic: State macro selection with check boxes instead of drop down menu?
- Replies: 33
- Views: 1647
Re: State macro selection with check boxes instead of drop down menu?
If the campaign only contains your states and they're all image states you can just do getTokenStates(","). Otherwise you'll have to get each group and join them. sGroup1=getTokenStates(",","Group1") sGroup2=getTokenStates(",","Group2") sStates=ListA...