Character Sheet: Saving Data?

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
Huscurian
Cave Troll
Posts: 38
Joined: Wed Jun 29, 2011 5:57 pm

Character Sheet: Saving Data?

Post by Huscurian »

I am not done with the character sheet. It's still a work in progress. However, I've managed to create a table that includes multiple checkboxes for specific table columns.

I have five columns already made: Light, Serious, Critical, Mortal 0, Mortal 1. Each column has 4 checkboxes. Here's the question. How does one save the data? Assume that the GM is running the session and tracks the character's wounds. He clicks off a few checkboxes. When he saves the campaign, he should at least log off Mote then log back in to find that the wounds table has been saved since the last session. There's no need to change the settings all over again.

Is there a way to actually save those checkboxes without having to redo them again? I'm pretty stumped about this part.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Character Sheet: Saving Data?

Post by aliasmask »

Are you using <form> for user input or Wiki: input()?

Huscurian
Cave Troll
Posts: 38
Joined: Wed Jun 29, 2011 5:57 pm

Re: Character Sheet: Saving Data?

Post by Huscurian »

aliasmask wrote:Are you using <form> for user input or Wiki: input()?
Input. The CS is formed as a [frames()] with HTML code. Here's the current code that I have right now for the CS, regarding the checkboxes:

Code: Select all

NOTE: Still currently under the works.

<table cellpadding=3>
	<tr>
		<!-- Wounds Modifiers -->
		<td align="center" colspan=5><b>Wounds</b></td>
	</tr>
	<tr>
		<td align="center">Light</td><td align="center">Serious</td><td align="center">Critical</td><td align="center">Mortal 0</td><td align="center">Mortal 1</td>
	</tr>
	<tr>
		<!-- Light Checkboxes -->
		<td><input type="checkbox" name="clight" value=""><input type="checkbox" name="clight" value=""><input type="checkbox" name="clight" value=""><input type="checkbox" name="clight" value=""></td>
		<!-- Serious Checkboxes -->
		<td><input type="checkbox" name="cserious" value=""><input type="checkbox" name="cserious" value=""><input type="checkbox" name="cserious" value=""><input type="checkbox" name="cserious" value=""></td>
		<!-- Critical Checkboxes -->
		<td><input type="checkbox" name="ccritical" value=""><input type="checkbox" name="ccritical" value=""><input type="checkbox" name="ccritical" value=""><input type="checkbox" name="ccritical" value=""></td>
		<!-- Mortal 0 Checkboxes -->
		<td><input type="checkbox" name="cmortal0" value=""><input type="checkbox" name="cmortal0" value=""><input type="checkbox" name="cmortal0" value=""><input type="checkbox" name="cmortal0" value=""></td>
		<!--Mortal 1 Checkboxes -->
		<td><input type="checkbox" name="cmortal1" value=""><input type="checkbox" name="cmortal1" value=""><input type="checkbox" name="cmortal1" value=""><input type="checkbox" name="cmortal1" value=""></td>
	</tr>
	<tr>
		<td align="center">Stun 0</td><td align="center">Stun -1</td><td align="center">Stun -2</td><td align="center">Stun -3</td><td align="center">Stun -4</td>
	</tr>
	<tr>
		<td align="center">Mortal 2</td><td align="center">Mortal 3</td><td align="center">Mortal 4</td><td align="center">Mortal 5</td><td align="center">Mortal 6</td>
	</tr>
	<tr>
		<td><input type="checkbox" name="cmortal2" value=""><input type="checkbox" name="cmortal2" value=""><input type="checkbox" name="cmortal2" value=""><input type="checkbox" name="cmortal2" value=""></td>
	</tr>
</table>

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Character Sheet: Saving Data?

Post by aliasmask »

input() function is different than a <form> input which is what you're doing. I recommend reading this: http://www.lmwcs.com/rptools/wiki/Forms_tutorial

Here's the general format of what you want to do:
||| CODE |||

Code: Select all

NOTE: Still currently under the works.

<!-- macroName - the name of macro that processes the input. The values are passed json object where the key is the name and value is the value.
   If you have the same name then only the last one counts. I recommend putting 0 or 1 for checkbox values.
   none - running macroName produces no output.
-->

{H: processLink = macroLinkText("macroName@lib:token","none")]

<form action="[r: processLink]" method="json">
<table cellpadding=3>
   <tr>
      <!-- Wounds Modifiers -->
      <td align="center" colspan=5><b>Wounds</b></td>
   </tr>
   <tr>
      <td align="center">Light</td><td align="center">Serious</td><td align="center">Critical</td><td align="center">Mortal 0</td><td align="center">Mortal 1</td>
   </tr>
   <tr>
      <!-- Light Checkboxes -->
      <td><input type="checkbox" name="clight" value=""><input type="checkbox" name="clight" value=""><input type="checkbox" name="clight" value=""><input type="checkbox" name="clight" value=""></td>
      <!-- Serious Checkboxes -->
      <td><input type="checkbox" name="cserious" value=""><input type="checkbox" name="cserious" value=""><input type="checkbox" name="cserious" value=""><input type="checkbox" name="cserious" value=""></td>
      <!-- Critical Checkboxes -->
      <td><input type="checkbox" name="ccritical" value=""><input type="checkbox" name="ccritical" value=""><input type="checkbox" name="ccritical" value=""><input type="checkbox" name="ccritical" value=""></td>
      <!-- Mortal 0 Checkboxes -->
      <td><input type="checkbox" name="cmortal0" value=""><input type="checkbox" name="cmortal0" value=""><input type="checkbox" name="cmortal0" value=""><input type="checkbox" name="cmortal0" value=""></td>
      <!--Mortal 1 Checkboxes -->
      <td><input type="checkbox" name="cmortal1" value=""><input type="checkbox" name="cmortal1" value=""><input type="checkbox" name="cmortal1" value=""><input type="checkbox" name="cmortal1" value=""></td>
   </tr>
   <tr>
      <td align="center">Stun 0</td><td align="center">Stun -1</td><td align="center">Stun -2</td><td align="center">Stun -3</td><td align="center">Stun -4</td>
   </tr>
   <tr>
      <td align="center">Mortal 2</td><td align="center">Mortal 3</td><td align="center">Mortal 4</td><td align="center">Mortal 5</td><td align="center">Mortal 6</td>
   </tr>
   <tr>
      <td><input type="checkbox" name="cmortal2" value=""><input type="checkbox" name="cmortal2" value=""><input type="checkbox" name="cmortal2" value=""><input type="checkbox" name="cmortal2" value=""></td>
   </tr>
</table>
</form> 

Huscurian
Cave Troll
Posts: 38
Joined: Wed Jun 29, 2011 5:57 pm

Re: Character Sheet: Saving Data?

Post by Huscurian »

aliasmask wrote:input() function is different than a <form> input which is what you're doing. I recommend reading this: http://www.lmwcs.com/rptools/wiki/Forms_tutorial

Here's the general format of what you want to do:
I checked the contents within. I also did copy the <form></form> parts and added to the CS. So far, when I tried to add the checkboxes, it wasn't working. I also added the processForm macro and it doesn't process. It comes up with an error saying that I have 2 arguments when it only needs 1. I also have a property, "SKP" that keeps processForm from updating.

Could I be doing any of this wrong? Sorry if I sound like I'm off the mark. I've been up coding all day with little sleep. :P I couldn't help but try to finish this part of the CS.

EDIT: I tried to remove the SKP value from the TSKP value. It later produced an error saying that my ADDSTATS property has more than one "argument" since ADDSTATS adds all of the basic stats; it then is subtracted from the pool of total character points. I think processForm is acting weird.

For now, I have done the checkboxes but no way to save them. I may take a small nap before I tackle it again.

Post Reply

Return to “Macros”