ID:148625
 
Im trying to write a Create_Character proc, but I keep getting errors when I try. I was wondering if someone could write a Create_Character proc for saving and loading.

Heres the code I need to be put into the proc.

mob
var/team
mob/character_login
mob/Login()
team = (input("What team do you want to be on?","team") in list("Red","Blue"))
var/area/A = locate("[team] base")
if(!Move(A)) loc = locate(/turf) in A
if(team=="Red")
icon='red.dmi'
else
icon='blue.dmi'

No errors in it when connected to the other coding.

P.S. Im using this proc for a clickscreen for when people log into my game.
world
mob=/mob/ppp/Choosin
mob/proc/CreateCharacter()
mob/character_login
mob/Login()
var/team = (input("What team do you want to be on?","team") in list("Red","Blue"))
var/area/A = locate("[team] base")
if(!Move(A)) loc = locate(/turf) in A
if(team=="Red")
icon='red.dmi'
else
icon='blue.dmi'



if(!Move(A)) loc = locate(/turf) in A // This is an invalid expression.

var/area/A = locate("[team] base") // Variable defined but not used.

var/area/A = locate("[team] base") // locate undefined proc


I DONT GET IT. It all looks perfectly good.
In response to RainZero
You have an indentation problem and your usage of locate is incorrect so you probably want to take a look at how it works in the reference.
In response to Theodis
The locate() usage looks fine to me... what's wrong with it? :-\
In response to Crispy
Crispy wrote:
The locate() usage looks fine to me... what's wrong with it? :-\

You can send a text string to it without the \ref macro?
In response to Theodis
From the reference (relevant bits in red):

locate proc

Format:
locate(Type) in Container
locate(X,Y,Z)
<font color=red>locate(Tag)</font>
locate(TextRef)

Returns:
An object of the specified type or the turf at the given coordinates. <font color=red>If a text string is given in place of an object type, the object with the same tag is found.</font> If a container is given, only objects directly within that object are searched.
In response to Crispy
I musta accidently scanned over that :P.
In response to RainZero
RainZero wrote:
world
mob=/mob/ppp/Choosin
mob/proc/CreateCharacter()
mob/character_login
mob/Login()
var/team = (input("What team do you want to be on?","team") in list("Red","Blue"))
var/area/A = locate("[team] base")
if(!Move(A)) loc = locate(/turf) in A
if(team=="Red")
icon='red.dmi'
else
icon='blue.dmi'

The big problem here: You're using code you inherited from Zlegend2 whose origin you apparently don't know.

Some of this code originated with me: I showed him how to do a part of it. Zlegend2, however, put in this mistaken line:
if(team=="Red")
That should have been "red", not "Red". The reason is that the original input() line looked like this:
var/team = lowertext(input("What team do you want to be on?","team") in list("Red","Blue"))
That's why those parentheses are still there in your version. OneFishDown made the suggestion--a very bad one--to take out the lowertext() line to agree with the capitalized "Red", in essence putting in an extra mistake instead of fixing the one that was there. He didn't realize, you see, the origin of the code either, and didn't realize that all this code was predicated on the team var always being lowercase for simplicity. Zlegend2 followed this very bad advice, apparently missing a later post that showed up the mistake, and now you've picked up the code from where he left it.

So you have three things to fix:

  • Unindent everything under the var/area/A line; it should never have been indented another level.
  • Put lowertext back into the input() line as I've shown you.
  • Change "Red" in that if() line to the correct lowercase "red".

    Lummox JR