:: Forum >>

RPG Stats Sheet


I am Zachary Aerogos, a decent programmer in php and expert in HTML & CSS. I am NOT however that great at JAVAScript making. Hence me posting here.

My Request:

A RPG Statistic Sheet

It Be Some Thing Like This.

<center>[40] Points</center>

<div align="left">Strength [ ] [+] [-]</div><div align="right">Endurance [ ] [+] [-]</div>
<div align="left">Intelligence [ ] [+] [-]</div><div align="right">Wisdom [ ] [+] [-]</div>
<div align="left">Charm [ ] [+] [-]</div><div align="right">Dexterity [ ] [+] [-]</div>
<div align="left">Spirit Points [ ] [+] [-]</div><div align="right">Armour Class [ ] [+] [-]</div>

If you press the + then that stat would rise by 1 and 40 at the top would drop to 39. It would be the opposite for the -. When done a person would hit submit.

Any Ideas on how to do this or where I can obtain something similar?
Zachary Aerogos
Monday, March 21, 2005
You should output the one "total amount of points"-value and the four stat values each in its own (read-only) textfield to make them accessible to the JS document object model give them IDs (e.g. id="strength" name="stength").
The plus and minus signs should be links to attach an onClick event handler to them that, when triggered, calls a JS function, let's name it modStat, which takes the two parameters (statToModify, mode), e.g. onClick="modStat('strength','+');".

function modStat(s,m) {
if (m == "+") {
// raise stat
document.getElementById(s).value += 1;
document.getElementById("total").value -= 1;
} else {
// lower stat
document.getElementById(s).value -= 1;
document.getElementById("total").value += 1;

Haven't tested it, but the solution lies along these lines. You might want to check on the server side of your application if the sum of all stat values equals 40 (and does not exceed it --> cheat/hack attempt).
Thursday, October 27, 2005

This topic is archived.

Back to support forum

Forum search