ID:140981
 
Code:
turf
titlescreen
density = 1
mainscreen
icon = 'titlescreen.png'
newchar
Click()
if(fexists("Playersavefiles/[usr.key].sav"))
if(alert("Character is found.\n Would you like to start a new character and overwrite previous savefile?","","Yes","No") != "Yes")
return
NEW
var/N = input("What is your character's name?","Character Name") as text
if(length(N) < 4 || length(N) > 16)
usr << "Character's name has to be between 4 to 16 characters in length..."
goto NEW
var/C = input("What is your character's class?","Class Selection") in list("Fighter","Defender","Black Mage","White Mage","Spellblade","Gunner")
switch(alert("Name: [N]\nClass: [C]\n","Confirmation","Yes","No"))
if("Yes")
if("No")
goto NEW
usr.name = "N"
usr.CLASS = "C"
usr = /mob/player/fighter()
usr.loc=locate(1,1,1)
usr.Save()

mob/player
CLASS = ""
ID = "hero"
icon = 'hero.dmi'
world
mob = /mob/player


Problem description:
I have several questions about this code. First of all, how do I make it so that even when I accidentally click on newchar like 3 or 4 times, the alert will just pop up once and finish the whole way through. Like I don't want to have go through "What is your character's name" 3 times before actually going to "What is your character's class?" Second question is concerning on the way I create new characters. As you see, you pick the class. I have it in my code in where it's like mob/player/fighter and mob/player/whitemage, etc, so how would I make it so the default mob/player will be mob/fighter, etc. when they create their character. Third question, if I have Stat() under mob/player, mob/player/fighter,etc. should be able to have that as well right?
okay so the pop up wont keep popping up every time you click on then and wont spam yourself try maybe using a var and make the action of when you click go though the var before anything maybe something like so
Code:
mob/var
creation = 0 //var used in the creation below

turf
titlescreen
density = 1
mainscreen
icon = 'titlescreen.png'
newchar
Click()
if(!usr.creation)//check if the usr is already creating
usr.creation = 1 //Makes it so the usr wont get more than one alert from clickin new at the same time
if(fexists("Playersavefiles/[usr.key].sav"))
if(alert("Character is found.\n Would you like to start a new character and overwrite previous savefile?","","Yes","No") != "Yes")
if("No")
usr.creation = 0 // I am guessing it closes the alert pop up when you click no and if so this should be in the right position so that it will let you click it again if you wish to after clicking no
return
NEW
var/N = input("What is your character's name?","Character Name") as text
if(length(N) < 4 || length(N) > 16)
usr << "Character's name has to be between 4 to 16 characters in length..."
goto NEW
var/C = input("What is your character's class?","Class Selection") in list("Fighter","Defender","Black Mage","White Mage","Spellblade","Gunner")
switch(alert("Name: [N]\nClass: [C]\n","Confirmation","Yes","No"))
if("Yes")
if("No")
goto NEW
usr.name = "N"
usr.CLASS = "C"
usr = /mob/player/fighter //all i did here was take out the () maybe that will work for your second question if it doesnt then let me know i was kinda confused on what you where trying to ask
usr.loc=locate(1,1,1)
usr.Save()

okay for your third question I'm guessing you are asking if you could have different starting stats for each class, the answer to that is yes you can