Editing str props on a token with a form, loading StrProps.

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Editing str props on a token with a form, loading StrProps.

Post by femanon »

Does anyone know how to do this without a library token? I've seen it done before but the form in the rptools wiki doesn't even work

[spoiler=][dialog("weaponInput"): {
[h: weaponNum = getStrProp(macro.args, "Number")]
[h: name = getStrProp(macro.args, "Name")]
[h: bonus = getStrProp(macro.args, "Bonus")]
[h: damage = getStrProp(macro.args, "Damage")]
<!-- If we do not have a weapon number grab the next one -->
[h, if(weaponNum == ""), code: {
[h,macro("[email protected]"): ""]
[h: weaponNum = macro.return]
}]
<html>
<head>
<title>Edit Weapon Dialog</title>
<meta name="input" content="true">
</head>
<body>
<form name="weaponInput" action="[r:macroLinkText('[email protected]:Test')]">
<table>
<tr>
<th>
<label for="Name">Weapon Name</label>
</th>
<td>
<input type="text" name="Name" value="[r: name]"></input> <br>
</td>
</tr>
<tr>
<th>
<label for="Damage">Weapon Damage</label>
</th>
<td>
<input type="text" name="Damage" value="[r: damage]"></input> <br>
</td>
</tr>
<tr>
<th>
<label for="Bonus">Weapon Bonus</label>
</th>
<td>
<input type="text" name="Bonus" value="[r: bonus]"></input>
</td>
</tr>
</table>
<!-- hidden input with the weapon number -->
<input type="hidden" name="Number" value="[r: weaponNum]"></input>

<input type="submit" name="Save" value="Save"> </input>
</form>
</body>
</html>
}][/spoiler]
Last edited by femanon on Mon Oct 01, 2012 2:27 pm, edited 1 time in total.


femanon
Cave Troll
Posts: 95
Joined: Sat Jun 16, 2012 10:25 pm

Re: Editing str props on a token with a form, no library

Post by femanon »

Code: Select all

<table width="*">
<tr>
<th colspan="2">Primary Attributes</th>
</tr>
[h: ArmorPenalty = getStrProp(Description, "ACpen")]
[h: attributes = "Strength, Dexterity, Intelligence, ArmorPenalty"]
[h: row = "odd"]
[r, foreach(attrib, attributes, ""), code: {
<tr class="[r:row]">
<td><b>[r:attrib]:</b></td>
<td><input type="text" name="[r:attrib]" value="[r:getProperty(attrib, id)]" size="3" align="right"></td>
</tr>
[h: row = if(row=="odd", "even", "odd")]
}]
<input type="submit" name="edit_btn" value="Submit changes">
</form>
}]


Can anyone tell me why Armor Penalty doesn't load its' variable correctly?

Post Reply

Return to “Macros”