User:Verisimilar/Sandbox: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
<source lang="mtmacro" line>
==Highlight Test==
<syntaxhighlight lang="mtmacro" highlight="5" line>
Function outside of the brackets:
defineFunction()
 
Function within square brackets:
[assert()]
 
Function within curly brackets:
{abort(0)}
 
Roll options:
[h: abort(0)]
[t: abort(0)]
[e,if(0): ]
[macro(): ]
[token(): ]
 
Numbers:
 
[h: 1 2 34 567 ]
 
Symbols:
[h: > = ! & / : ; ]
 
Strings:
[h: "This is a double quoted string" ]
[h; "This is a single quoted string" ]
 
</syntaxhighlight>
 
 
==prop macros==
<syntaxhighlight lang="mtmacro" line>
@onCampaignLoad
@onCampaignLoad
[defineFunction("get", "get@this")]
[defineFunction("get", "get@this")]
Line 5: Line 38:
@get
@get
[h: checkProp = json.contains(getPropertyNames('json'), arg(0))]
[h: checkProp = json.contains(getPropertyNames('json'), arg(0))]
[h,assert(checkProp, '<b>ERROR:</b> get("'+arg(0)+'") - That property does not exist.', 0)]
[h,assert(checkProp, '<b>ERROR:</b> get("'+arg(0)+'") '+
                    '- That property does not exist.', 0)]
[h, macro.return = getProperty(arg(0))]
[h, macro.return = getProperty(arg(0))]


Line 13: Line 47:
@set
@set
[h: checkProp = json.contains(getPropertyNames('json'), arg(0))]
[h: checkProp = json.contains(getPropertyNames('json'), arg(0))]
[h,assert(checkProp, '<b>ERROR:</b> set('+arg(0)+', '+arg(1)+') - That property does not exist.', 0)]
[h,assert(checkProp, '<b>ERROR:</b> set('+arg(0)+', '+arg(1)+') '+
                    '- That property does not exist.', 0)]
[h: setProperty(arg(0), arg(1))]
[h: setProperty(arg(0), arg(1))]
[h, macro.return = 1]
[h, macro.return = 1]
</source>
</syntaxhighlight>

Latest revision as of 17:00, 13 March 2023

Highlight Test

Function outside of the brackets:
defineFunction()

Function within square brackets:
[assert()]

Function within curly brackets:
{abort(0)}

Roll options:
[h: abort(0)]
[t: abort(0)]
[e,if(0): ]
[macro(): ]
[token(): ]

Numbers:

[h: 1 2 34 567 ]

Symbols:
[h: > = ! & / : ; ]

Strings:
[h: "This is a double quoted string" ]
[h; "This is a single quoted string" ]


prop macros

@onCampaignLoad
[defineFunction("get", "get@this")]

@get
[h: checkProp = json.contains(getPropertyNames('json'), arg(0))]
[h,assert(checkProp, '<b>ERROR:</b> get("'+arg(0)+'") '+
                     '- That property does not exist.', 0)]
[h, macro.return = getProperty(arg(0))]

@onCampaignLoad
[defineFunction("set", "set@this")]

@set
[h: checkProp = json.contains(getPropertyNames('json'), arg(0))]
[h,assert(checkProp, '<b>ERROR:</b> set('+arg(0)+', '+arg(1)+') '+
                     '- That property does not exist.', 0)]
[h: setProperty(arg(0), arg(1))]
[h, macro.return = 1]