User:Verisimilar/Sandbox: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(CategoryTree examples)
mNo edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
==#CategoryTree:MapTool|mode=pages==
==#categorytree:MapTool|mode=pages==
{{#categorytree:MapTool|mode=pages}}
{{#categorytree:MapTool|mode=pages}}
==#CategoryTree:MapTool|mode=categories==
==#categorytree:MapTool|mode=categories==
{{#categorytree:MapTool|mode=categories}}
{{#categorytree:MapTool|mode=categories}}


Line 21: Line 21:
@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 29: Line 30:
@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>
</source>

Revision as of 19:17, 29 March 2009

#categorytree:MapTool|mode=pages

#categorytree:MapTool|mode=categories






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]