Page 1 of 1

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

Posted: Mon Oct 01, 2012 8:03 am
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("NextWeaponNumber@this"): ""]
[h: weaponNum = macro.return]
}]
<html>
<head>
<title>Edit Weapon Dialog</title>
<meta name="input" content="true">
</head>
<body>
<form name="weaponInput" action="[r:macroLinkText('AddWeapon@Lib: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>
}]

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

Posted: Mon Oct 01, 2012 10:53 am
by wolph42
well change the macro@lib:xxx into macro@this and make sure that that macro exists on the token.

Which wiki entry are you referring at?

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

Posted: Mon Oct 01, 2012 11:08 am
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?