ID:262048
 
How do I fix this so that it goes back to the Class selection?
mob/create_character
var/mob/character
Login()
var/charactername = input("Hello, Pick a name for your character, something you wish for people to call you in the game.","Character Name?")
switch(input("Below pick one of the following backgrounds you wish for your character to be. Be careful choosing because they have different strength defence and even different amounts of exp they need to level.","Character Background?") in list("Ninja"))
if ("Ninja")
switch(input("Are you sure you want this background? It has high strength and high defence but also high exp to get.","Character Background") in list("Yes Please","NO Thank You"))
if ("Yes Please")
alert("A special thanks to Ham-warrior400 for his RPG starter. I wouldn't be here if not for him!!")
character = new /mob/You/Warrior()
if ("No Thank You")
Login()
i didnt test it but this should work
mob/create_character
var/mob/character
Login()
START
var/charactername = input("Hello, Pick a name for your character, something you wish for people to call you in the game.","Character Name?")
switch(input("Below pick one of the following backgrounds you wish for your character to be. Be careful choosing because they have different strength defence and even different amounts of exp they need to level.","Character Background?") in list("Ninja"))
if ("Ninja")
switch(input("Are you sure you want this background? It has high strength and high defence but also high exp to get.","Character Background") in list("Yes Please","NO Thank You"))
if ("Yes Please")
alert("A special thanks to Ham-warrior400 for his RPG starter. I wouldn't be here if not for him!!")
character = new /mob/You/Warrior()
if ("No Thank You")
goto START
In response to Kablez
It works thank you very much.
In response to Kablez
Kablez wrote:
i didnt test it but this should work

NO NO NO. Do NOT use goto for a simple loop.

The correct way to fix this code is to use a while() loop:
while(!charactername)
switch(...)
...
if("No thank you")
continue // keep going
The goto command should only be used for loops so complicated that an example would be fruitless. Never use it where a simple loop would suffice.

Lummox JR