Break and Return
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.
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.
-
- Cave Troll
- Posts: 33
- Joined: Thu Aug 02, 2012 9:36 pm
Break and Return
Are there break and return commands for maptool?
Re: Break and Return
There is Wiki: abort(), but that ends macro execution and not just that particular macro call. You can create other macro execution chains with Wiki: execLink() and using the defer parameter. What that will do is start another macro when the current execution chain ends. But if you're looking just just bail out of a loop, I would use [while:] and set the condition to escape inside the loop. The loop still keeps track of the roll.count, but I recommend assigning it to a variable at the top of the loop because there are things out there that may change it in the middle of loop.
This would just loop 11 times because roll.count starts at 0, but you can set whatever condition you like based off of calculations rather than the index. But I would also build in a max loop condition so it doesn't run forever (1000 iterations is maptool max).
Code: Select all
[H: condition = 1]
[H, while(condition), code: {
[H: index = roll.count]
<!-- do stuff -->
<!-- set condition to exit -->
[H: condition = if(index >= 10,0,1)]
}]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools