I have looked around for a possible answer, but I can't figured out why I keep getting a JScript error. I am making a character sheet for my friends and I for Pokemon Tabletop Adventures and to calculate the max hp you use this calculation: Con * 4 + Lvl * 4. How can I get this to work? Also is there any way I can make a drop down for pokemon so I just select it from the list and it fills in some info for me? And finally is there a way to make requirements for drop downs where you can't select it if you don't meet the requirements?
Comments
"Class","Adcost","ClassWL","ability1","ability2","ability3","ability4","ar1","ar2","ar3","ar4"
"Animist",3,1,"Survival","Wield"," "," ",1,1," "," "
"Burglar",6,2,"Chicanery","Observe","Sneak","Tinker",1,1,1,1
"Faithful",3,1,"Mettle","Wield"," "," ",1,1," "," "
"Gearhead",4,2,"Maneuver","Tinker"," "," ",1,1," "," "
"Medic",5,2,"Athletics","First Aid","Mettle"," ",1,1,1," "
"Mentalist",3,1,"Observe","Wield"," "," ",1,1," "," "
"Occultist",3,1,"Academics","Wield"," "," ",1,1," "," "
"Scholar",3,1,"Academics","Observe"," "," ",1,1," "," "
"Scout",5,2,"Observe","Sneak","Survival"," ",1,1,1," "
"Thug",5,2,"Athletics","Coerce","Street Smarts"," ",1,1,1," "
"Veteran",7,4,"Athletics","Fight","Shoot"," ",1,1,1," "
"NIL"," "," "," "," "," "," "," "," "," "," "
The first row contains the column names separated by commas. So for your Pokemon type it's name would be the first entry. So in Character Sheet Designer I have a field selected, and its Field Name is "ClassA", don't use spaces in the names. To the right there is an entry for List: It contains a drop down list which I used to choose "ClassAdCost" which is the CSV file. This is what gives me a drop down list of Animist, Burglar, Faithful, etc.
Now the rest of the values in this CSV file are pulled by javascript and sent to various fields. For example on the first page of the character sheet there is a field which has AdC. above it, the fields name is actually "AdCost1", under source I entered "Lookup('ClassAdCost', ClassA.Text, 'Adcost')", List is set to "BaseAdCost".
BaseAdCost is in the list manager and has values of:
+3
+4
+5
+6
+7
The javascript for the Character sheet looks like this, which is where you will find "ClassA.Text":
//Script Author G.B. MacKenzie
//Copyright © 2006–2011 The Welsh Piper. All rights reserved.
//The Chimera Roleplaying GameTM and The Chimera RPG logo are trademarks owned by The Welsh Piper.
//May 22, 2012
//Define Global Function
function Chimera()
{
//Define a new container, an array, which will eventually contain all of the characters abilities. The index of this array will be used to match the content of the array to fields in CSD.
var myContainer = new Array();
//Define an array to contain the Class chosen by the user.
var myChosenClass = new Array();
//End Global Array Definitions
//First Class Field
//Begin sorting what goes into myContainer
//This is based on the user's choice for now lets simply define it:
myChosenClass = ClassA.Text
//The first Class Field Abilities can simply be pushed to the myContainer Array
if (myChosenClass === "Animist")
{
myContainer.push("Wield"); //Animist has two Abilities
myContainer.push("Survival");
}
if (myChosenClass === "Burglar")
{
myContainer.push("Observe");
myContainer.push("Sneak");
myContainer.push("Tinker");
myContainer.push("Chicanery");
}
if (myChosenClass === "Faithful")
{
myContainer.push("Wield");
myContainer.push("Mettle");
}
if (myChosenClass === "Gearhead")
{
myContainer.push("Tinker");
myContainer.push("Maneuver");
}
if (myChosenClass === "Medic")
{
myContainer.push("Athletics");
myContainer.push("Mettle");
myContainer.push("First Aid");
}
if (myChosenClass === "Mentalist")
{
myContainer.push("Observe");
myContainer.push("Wield");
}
if (myChosenClass === "Occultist")
{
myContainer.push("Wield");
myContainer.push("Academics");
}
if (myChosenClass === "Scholar")
{
myContainer.push("Observe");
myContainer.push("Academics");
}
if (myChosenClass === "Scout")
{
myContainer.push("Observe");
myContainer.push("Sneak");
myContainer.push("Survival");
}
if (myChosenClass === "Thug")
{
myContainer.push("Athletics");
myContainer.push("Coerce");
myContainer.push("Shoot");
myContainer.push("Street Smarts");
}
if (myChosenClass === "Veteran")
{
myContainer.push("Athletics");
myContainer.push("Fight");
myContainer.push("Shoot");
}
//Second Class Field
//This must match the Second Class field and add the Class Abilities to the myContainer Array but only if an Ability is not already in the Array
//Begin sorting what goes into myContainer
//This is based on the user's choice for now lets simply define it:
myChosenClass = ClassB.Text
//The first Class Field Abilities can simply be pushed to the myContainer Array
if (myChosenClass === "Animist")
{
myContainer.push("Wield"); //Animist has two Abilities
myContainer.push("Survival");
}
if (myChosenClass === "Burglar")
{
myContainer.push("Observe");
myContainer.push("Sneak");
myContainer.push("Tinker");
myContainer.push("Chicanery");
}
if (myChosenClass === "Faithful")
{
myContainer.push("Wield");
myContainer.push("Mettle");
}
if (myChosenClass === "Gearhead")
{
myContainer.push("Tinker");
myContainer.push("Maneuver");
}
if (myChosenClass === "Medic")
{
myContainer.push("Athletics");
myContainer.push("Mettle");
myContainer.push("First Aid");
}
if (myChosenClass === "Mentalist")
{
myContainer.push("Observe");
myContainer.push("Wield");
}
if (myChosenClass === "Occultist")
{
myContainer.push("Wield");
myContainer.push("Academics");
}
if (myChosenClass === "Scholar")
{
myContainer.push("Observe");
myContainer.push("Academics");
}
if (myChosenClass === "Scout")
{
myContainer.push("Observe");
myContainer.push("Sneak");
myContainer.push("Survival");
}
if (myChosenClass === "Thug")
{
myContainer.push("Athletics");
myContainer.push("Coerce");
myContainer.push("Shoot");
myContainer.push("Street Smarts");
}
if (myChosenClass === "Veteran")
{
myContainer.push("Athletics");
myContainer.push("Fight");
myContainer.push("Shoot");
}
//Third Class Field
//This must match the Second Class field and add the Class Abilities to the myContainer Array but only if an Ability is not already in the Array
//Begin sorting what goes into myContainer
//This is based on the user's choice for now lets simply define it:
myChosenClass = ClassC.Text
//The first Class Field Abilities can simply be pushed to the myContainer Array
if (myChosenClass === "Animist")
{
myContainer.push("Wield"); //Animist has two Abilities
myContainer.push("Survival");
}
if (myChosenClass === "Burglar")
{
myContainer.push("Observe");
myContainer.push("Sneak");
myContainer.push("Tinker");
myContainer.push("Chicanery");
}
if (myChosenClass === "Faithful")
{
myContainer.push("Wield");
myContainer.push("Mettle");
}
if (myChosenClass === "Gearhead")
{
myContainer.push("Tinker");
myContainer.push("Maneuver");
}
if (myChosenClass === "Medic")
{
myContainer.push("Athletics");
myContainer.push("Mettle");
myContainer.push("First Aid");
}
if (myChosenClass === "Mentalist")
{
myContainer.push("Observe");
myContainer.push("Wield");
}
if (myChosenClass === "Occultist")
{
myContainer.push("Wield");
myContainer.push("Academics");
}
if (myChosenClass === "Scholar")
{
myContainer.push("Observe");
myContainer.push("Academics");
}
if (myChosenClass === "Scout")
{
myContainer.push("Observe");
myContainer.push("Sneak");
myContainer.push("Survival");
}
if (myChosenClass === "Thug")
{
myContainer.push("Athletics");
myContainer.push("Coerce");
myContainer.push("Shoot");
myContainer.push("Street Smarts");
}
if (myChosenClass === "Veteran")
{
myContainer.push("Athletics");
myContainer.push("Fight");
myContainer.push("Shoot");
}
//myContainer now contains all Class Abilities including duplicates
//sort myContainer alphabetically, the default
//remove any duplicate entries if the previous entry in the array is the same
myContainer.sort();
for (var i = 1; i < myContainer.length; i++)
{
if (myContainer === myContainer[ i - 1 ])
{
myContainer.splice( i--, 1 );
}
}
//Output the content of myContainer into the Ability Fields
Ability.Text = (myContainer[0]);
Ability1.Text = (myContainer[1]);
Ability2.Text = (myContainer[2]);
Ability3.Text = (myContainer[3]);
Ability4.Text = (myContainer[4]);
Ability5.Text = (myContainer[5]);
Ability6.Text = (myContainer[6]);
Ability7.Text = (myContainer[7]);
Ability8.Text = (myContainer[8]);
Ability9.Text = (myContainer[9]);
Ability10.Text = (myContainer[10]);
Ability11.Text = (myContainer[11]);
Ability12.Text - (myContainer[12]);
}//end of main function
//find the content of the Ability Fields and if not empty set Base IP to 1 else 0
//Note it may simply be undefined hence != false rather than null
function Abilitya()
{
if (Ability.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityb()
{
if (Ability1.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityc()
{
if (Ability2.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityd()
{
if (Ability3.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilitye()
{
if (Ability4.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityf()
{
if (Ability5.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityg()
{
if (Ability6.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityh()
{
if (Ability7.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityi()
{
if (Ability8.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityj()
{
if (Ability9.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityk()
{
if (Ability10.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilityl()
{
if (Ability11.Text != false)
{
return "1";
}
else
{
return "0";
}
}
function Abilitym()
{
if (Ability12.Text != false)
{
return "1";
}
else
{
return "0";
}
}
//function to calculate the Wound Penalty
function WoundPenalty()
{
if (WPZ.Text != false)
{
return "12";
}
if (WPY.Text != false)
{
return "11";
}
if (WPX.Text != false)
{
return "10";
}
if (WP9.Text != false)
{
return "9";
}
if (WP8.Text != false)
{
return "8";
}
if (WP7.Text != false)
{
return "7";
}
if (WP6.Text != false)
{
return "6";
}
if (WP5.Text != false)
{
return "5";
}
if (WP4.Text != false)
{
return "4";
}
if (WP3.Text != false)
{
return "3";
}
if (WP2.Text != false)
{
return "2";
}
if (WP1.Text != false)
{
return "1";
}
else
{
return "0";
}
}
//First Class Field
//Begin sorting what goes into myContainer
//This is based on the user's choice for now lets simply define it:
myChosenClass = ClassA.Text
//The first Class Field Abilities can simply be pushed to the myContainer Array
if (myChosenClass === "Animist")
{
myContainer.push("Wield"); //Animist has two Abilities
myContainer.push("Survival");
}
rBonus.Value +rImprov.Value