ID:142850
 
Code:
Login()
var/charactername = input("What is your name,[src.key]")//you should know this..
switch input("What time period were you born in?","Time Period","Unification (Cyber)") in list("Civil era(Cyber)","Present Day (Ops Pilot)")
if ("Unification(Cyber)") //if they chose to be a cyborg"
character = new /mob/Cyber() //make the new character a Cyborg!"
if("Present Day (Ops Pilot)") //if they wanna be human,"
character = new /mob/OpPilot() //make them on


The problem is I dont see the error or the mistake..the spot where the ( is supposed to be because to me it looks correct. Someone help me correct this issue with the login class selection:

Problems with your previous code
  • Had an option in the input(x) and not in the list(x)
  • Was not setting charactername for the player, rather a world varible
  • Forgot to add MOB to the top. Otherwise, who does it perform the code for? Who calls Login()?


Assumed fix code:

mob
var
charactername
Login()
src.charactername = input("What is your name","[src.key]")//you should know this..
switch(input("What time period were you born in?","Time Period") in list("Unification(Cyber)","Present Day (Ops Pilot)"))

if("Unification(Cyber)") //if they chose to be a cyborg"
src = new /mob/Cyber() //make the new character a Cyborg!"
if("Present Day (Ops Pilot)") //if they wanna be human,"
src = new /mob/OpPilot() //make them on


You could have used this, but it would have made the list ugly:

    Login()
src.charactername = input("What is your name","[src.key]")//you should know this..
var/mob/Selection = input("What time period were you born in?","Time Period") in list(/mob/Cyber, /mob/OpPilot)
src = new Selection


Though, saves on space if you don't like tons of code.
EDIT: Ahh great..Siientxx found the missing element!

Forget what I say below. I still don't know how the system knows the difference between one kind of in and another...

Original clueless reply:
--------------------------
Sorry I'm not experienced but will try to help.

In the input proc section, they show this code:
   usr.gender = input("Select a gender for your character.",
"Your Gender",
usr.gender) in list("male","female","neuter")


But in the in operator section, it says:
Returns:
1 if A exists in List; 0 if not


So you have one syntax variable = input(...) in list(...) that evaluates to an item from the list. And you have another syntax A in List that evaluates to a 1 or 0 depending on whether A is in the list.

I wonder if putting it in a switch gets the system to see the in operator as a 1 or 0 thing. If so, then maybe you can separate the input from the switch and see if it helps:
    var/timeperiod = input("What time period were you born in?","Time Period","Unification (Cyber)") in list("Civil era(Cyber)","Present Day (Ops Pilot)")
switch(timeperiod)
if("Unification...) //... etc


It looks the same, but maybe the system will put the in keyword in a different context.

Good luck...
Zerowing wrote:
Code:
world
mob = /mob/create_character //set the default mob to create_character, as to make the selection stuff happen
view = 7 //I prefer 7...
turf = /turf/grass
mob/OpPilot // let's create a pilot
icon = 'player.dmi' //the pilot will look like this!
verb //the Human race is quite primitive, so the things it can do are limited
//the things it can do are...
Warcry() //yell for no reason!
world << "[usr] YAaaaaaaaaa !"
World Speak(msg as text) //run !
world << "[usr] Speaks Confidently"
middle_finger() //self explanitory!
world << "[usr] Throws up middle finger! !'"

mob/Cyber
icon = 'Cyber.dmi' //this is what it will look like. quite ugly, no?
verb //the Cybers are more intelligent than the primitive Humans
WorldSpeak(msg as text)
world << "[usr] says, in a Arrogant sophisticated voice, '[msg]!'" //very sophisticated!
middle_finger() //finger!
world << "[usr] Flips off middle finger."
Spark() //they have much more developed brain power - they can philosophize meaningful things!
world << "[usr] Sparks a Cig!"

turf/grass //
icon = 'turfs.dmi' //some grass! it'll look like
icon_state = "grass" // this!



mob/create_character //the default mob
var/mob/character //later we'll be switching client to this


Login()
var/charactername = input("What is your name,[src.key]")//you should know this..
switch input("What time period were you born in?","Time Period","Unification (Cyber)") in list("Civil era(Cyber)","Present Day (Ops Pilot)")
if ("Unification(Cyber)") //if they chose to be a cyborg"
character = new /mob/Cyber() //make the new character a Cyborg!"
if("Present Day (Ops Pilot)") //if they wanna be human,"
character = new /mob/OpPilot() //make them on

>

This is the complete code i accidentally erased the last part with the delete stuff.Doh! >.<

In response to Zerowing
mob/Login()
var/charactername = input("What is your name,[src.key]")as text|null//you should know this..
charactername = name
switch(input("What time period were you born in?","Time Period","Unification (Cyber)") in list("Civil era(Cyber)","Present Day (Ops Pilot)"))
if ("Unification(Cyber)") //if they chose to be a cyborg"
character = new /mob/Cyber() //make the new character a Cyborg!"
if("Present Day (Ops Pilot)") //if they wanna be human,"
character = new /mob/OpPilot() //make them on


Try that.