I am trying to make it so that if you accidentally select a race that you don’t like, or change your mind, you can choose to go back a page, but i cant quite figure out how to make it more streamlined. currently, if you choose option 1. under the Human race selection screen, it then replaces the 1 in the text box with c, and you have to press the submit button again to go back a page. i would like it if i could make it so that you press submit with 1 in the text box, and it instantly goes back a page.
//Variables
//Character Stat and Detail Variables
//Character Details
var Character_Name = [""];
var Age = [""];
var Alignment = [""];
var Religion = [""];
var Background = [""];
var Descendency = [""];
var Hair = [""];
var Race = [""];
var Height = [""];
var Gender = [""];
var Size = [""];
var Weight = [""];
//Character Stats
var Health = [""];
var Stamina = [""];
var Mana = [""];
var Strength = [""];
var Dexterity = [""];
var Agility = [""];
var Constitution = [""];
var Endurance = [""];
var Fighting = [""];
var Intelligence = [""];
var Psyche = [""];
var Wisdom = [""];
var Intuition = [""];
var Reason = [""];
var Charisma = [""];
var Physical_Beauty = [""];
//Character Abilities
var Spells = [""];
var Skills = [""];
var Abilities = [""];
var Talents = [""];
var Special_Abilities = [""];
var Ultimate_Talents = [""];
//Character Inventory
var Inventory = [""];
//Item Variables
//Character Items
var Weapon_Tool_Names = ["Basic Wand, Basic Staff, "];
var Spell_Names = [""];
var Skill_Names = [""];
var Ability_Names = [""];
var Talent_Names = [""];
var Special_Ability_Names = [""];
var Ultimate_Talent_Names = [""];
//Quest Items
var Quest_Items
//Story Variables
var Title = ["Untold Magius"];
var Story = ["You wake up with the sun shining in your eyes. \nWhat do you do? \n\na. Stand up \nb. Sit up \nc. Check yourself for injuries"];
var Quests = ["A barren mind"];
//Unused quest names
//Awakening
//Beginnings
//Memories
//Shadows of the past
//Beach of mystery
//A forgotten past
//Land/Beach of questions
//Questioning sands
//World of lost beginnings
//Beach of unknown pasts
//A snake in our midst
//Jungles of time
//A future unseen
var CurrentArea = ["StarterBeach"];
var Areas = ["StarterBeach"];
//Map link? or maybe make an interactive map that auto updates later on in the game?
//Setup
//Main Canvas Setup
function setup()
{
createCanvas(600,600);
background(0);
input = createInput();
input.position(210,500);
input.size(200);
button = createButton("submit");
button.position(430,501);
button.mousePressed(greet);
}
//Text Control and Game Coloring
function draw()
{
fill(190);
rect(-1,-1,600,50);
fill(150);
rect(-1,50,600,600);
drawTitle(width * 0.5);
drawStory(width * 0.015);
drawError(width * 0.5);
}
//Title Text
function drawTitle(x)
{
textAlign(CENTER);
textSize(45);
fill(0);
text(Title, x, 36);
}
//Story Text
function drawStory(x)
{
textAlign(LEFT);
textSize(20);
fill(0);
text(Story, x, 75);
}
//Error Text
function drawError(x)
{
textAlign(CENTER);
textSize(15);
fill(150,0,0);
text(ErrorMessage, x, 490);
}
//Main Menu
//Game Logic
var CurrentSubSection = ["SB1"];
var ErrorMessage = [""];
function greet()
{
var inputValue = input.value();
input.value("");
ErrorMessage = ("");
if (CurrentArea == "StarterBeach" && CurrentSubSection == "SB1" && inputValue == "a")
{
Story = ("You stand up, and look around.");
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "SB1" && inputValue == "b")
{
Story = ("You sit up and look around.");
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "SB1" && inputValue == "c")
{
Story = ("You look down and suddenly notice that you seem to" + "\nhave no memory of who you are, what you are," + "\nor where you have been in the past." + "\n\nPlease select your Race from the options below." + "\n\na. Human Variant" + "\nb. Elf Variant" + "\nc. Dwarf Variant" + "\nd. Gnome Variant" + "\ne. Giant Variant" + "\nf. Dragon Variant" + "\ng. Angel Variant" + "\nh. Demon Variant" + "\ni. Warforged Variant" + "\nj. Monster Variant");
CurrentSubSection = ("RS1");
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "a")
{
Story = ("Please select your race variant from the options below." + "\n\na. Human" + "\n1. Go Back A Page");
CurrentSubSection = ("RSH1");
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "b")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "c")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "d")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "e")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "f")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "g")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "h")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "i")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RS1" && inputValue == "j")
{
}
else if (CurrentArea == "StarterBeach" && CurrentSubSection == "RSH1" && inputValue == "1")
{
CurrentSubSection = ("SB1");
input.value("c");
}
else if (inputValue == "")
{
ErrorMessage = ("Please type something into the text box and click submit");
}
}