Hey Guys,
I'm looking at making a multi-line if statement is this possible?
Also are nested if's possible?
IF (condition = value) THEN
Line1
Line2
Line3
ELSE
Line1
Line2
Line3
END IF
Also wondering if you can write functions?
Call DamageTaken()
Function DamageTaken
{
IF (condition = value) THEN
Line1
Line2
Line3
ELSE
Line1
Line2
Line3
END IF
}
Can you give me an example in code?
Macro help - If Statements and Functions
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
- Xaelvaen
- Dragon
- Posts: 498
- Joined: Wed Aug 31, 2011 9:49 pm
- Location: Somewhere between Heaven and Hell
Re: Macro help - If Statements and Functions
Code: Select all
[h, if(condition=X), CODE:{
<!---- You can put multiple lines of code here----->
[h: variable1=Y]
[h: variable2=Z]
[h: output="This resulted in True."]
};{
<!---- Anything put here is the failure, or the not IF ----->
[h: variable1=1]
[h: variable2=2]
[h: output="This resulted in False."]
}]
Code: Select all
[h, if(condition=X), CODE:{
[h: variable1=Y]
[h: variable2=Z]
[h: output="This resulted in True."]
};{}]
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Macro help - If Statements and Functions
Be sure to check out this: http://lmwcs.com/rptools/wiki/Macros:Br ... nd_LoopingCixrTyx wrote:Hey Guys,
I'm looking at making a multi-line if statement is this possible?
Also are nested if's possible?
Can you give me an example in code?
In particular, look at how to use nested code blocks with the various branching and looping functions.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Macro help - If Statements and Functions
Thanks a ton guys? What about functions?
Re: Macro help - If Statements and Functions
Alright I have some code that is acting up on me? Can you guys help, and if you have the time write out some simple code for me?
I'm trying to make three super simple Hit Point macros; one for damage, one for healing, and one for temporary HP.
I need the damage macro to make sure that its doesn't go below 0 HP and it takes away from the TempHP first before the HP (e.g. I have 50 HP and 10 THP, I take 5 damage I now have 50 HP and 5 THP, I take 40 damage I now have 15 HP and 0 THP.)
Healing macro can't go above MaxHP.
TempHP should just set the THP to whatever value they enter, though make sure that if the value they enter is larger than the Current THP (e.g. I have 10 HP and 10 THP, I gain 5 THP I should still have 10 THP. If I gain 20 THP then I have 20 THP instead of the 10 I had).
I use this for D&D 5th Ed so it's those rules for TempHP.
My template is basic this is what's in it:
MaxHP:0
*@HP:0
*@TempHP:0
I need ot add more items in my basic template tell me and I will.
Can you guys help me out on this? I'm not a great programmer and I've been stuck on this for months and months now.
I'm trying to make three super simple Hit Point macros; one for damage, one for healing, and one for temporary HP.
I need the damage macro to make sure that its doesn't go below 0 HP and it takes away from the TempHP first before the HP (e.g. I have 50 HP and 10 THP, I take 5 damage I now have 50 HP and 5 THP, I take 40 damage I now have 15 HP and 0 THP.)
Healing macro can't go above MaxHP.
TempHP should just set the THP to whatever value they enter, though make sure that if the value they enter is larger than the Current THP (e.g. I have 10 HP and 10 THP, I gain 5 THP I should still have 10 THP. If I gain 20 THP then I have 20 THP instead of the 10 I had).
I use this for D&D 5th Ed so it's those rules for TempHP.
My template is basic this is what's in it:
MaxHP:0
*@HP:0
*@TempHP:0
I need ot add more items in my basic template tell me and I will.
Can you guys help me out on this? I'm not a great programmer and I've been stuck on this for months and months now.
Re: Macro help - If Statements and Functions
There's an example here: http://forums.rptools.net/viewtopic.php ... 00#p267480 of that.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Macro help - If Statements and Functions
You might be reinventing the wheel.CixrTyx wrote: I use this for D&D 5th Ed so it's those rules for TempHP.
Have you taken a look at the available 5e frameworks?
This one has been around awhile: http://forums.rptools.net/viewtopic.php?f=85&t=25490
And this one hasn't been released yet, but looks very promising and simple to use: http://forums.rptools.net/viewtopic.php?f=8&t=27296
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."