setStrProp: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
(Fixed existing example and added a new one)
Line 10: Line 10:
</source>
</source>


|example=
|examples=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: weapon = "name=longsword; damage=1d8; maxdamage=8"]
[h: weapon = "name=longsword; damage=1d8; maxdamage=8"]
[h: weapon = setStrProp(weapon, "value", 10)]
[h: weapon = setStrProp(weapon, "value", 10)]
[r: weapon]
</source>
</source>
Returns "longsword".
Returns "name=longsword ; damage=1d8 ; maxdamage=8 ; value=10 ; "
 
<source lang="mtmacro" line>
[h: weapon = "name=longsword; damage=1d8; maxdamage=8"]
[h: weapon = setStrProp(weapon, "damage", "1d6")]
[r: weapon]
</source>
Returns "name=longsword ; damage=1d6 ; maxdamage=8 ; "
 
}}
}}
[[Category:String Property List Function]]
[[Category:String Property List Function]]

Revision as of 01:02, 4 April 2009

setStrProp() Function

Introduced in version 1.3b42
Returns a string property list with the key set to the value passed in.

Usage

setStrProp(propList, key, value)

Examples

[h: weapon = "name=longsword; damage=1d8; maxdamage=8"]
[h: weapon = setStrProp(weapon, "value", 10)]
[r: weapon]

Returns "name=longsword ; damage=1d8 ; maxdamage=8 ; value=10 ; "

[h: weapon = "name=longsword; damage=1d8; maxdamage=8"]
[h: weapon = setStrProp(weapon, "damage", "1d6")]
[r: weapon]
Returns "name=longsword ; damage=1d6 ; maxdamage=8 ; "