ID:268236
 
    if(characters.len>1)
alert("You already have a character, please delete your current account and try again","ERROR!")


login.dm:148:error:characters.len:undefined var


whats wrong?
Vash_616 wrote:
    if(characters.len>1)
> alert("You already have a character, please delete your current account and try again","ERROR!")

login.dm:148:error:characters.len:undefined var


whats wrong?

characters does not have a len variable. A bit more code, like where you define characters, would be helpful.
In response to Jon88
Im just trying to make a proc when they create a character if they already have one they cant create another one and i was told to use characters.len
In response to Vash_616
Vash_616 wrote:
Im just trying to make a proc when they create a character if they already have one they cant create another one and i was told to use characters.len

If you showd the code it would help.
In response to XzDoG
I did look [link] !

someone please help me :(
In response to Vash_616
I think what 'XzDog' and 'Jon' meant was 'show where you define your characters variable', and the code around that.

[edit]
Sorry for not being specific enough, but i was talking about the people who were trying to help him
[/edit]
In response to Lazyboy
He obviously didn't. He simply heard somoene say to use "characters.len", and assumed that plugging that into his code would work.
In response to Garthor
mob/creating_character
src.CreateCharacter() //This tells the src to lookup "CreateCharacter"

proc/CreateCharacter()
var/mob/new_mob //We are declaring a new variable called "new_mob" which will be used in a little minute
var/char_name // We set a var for the characters name here and make it "null"
while(!char_name) // Here we check to see whether the characters name is null or text, if null we don't allow them in, if text, they are allowed in
char_name = input("What is your name?","Create a character") as null|text //The player makes their name here
char_name = html_encode(char_name)

if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return

var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
// if (characters.Find(ckey_name))
// alert("You already have a character named that! Please choose another name.")
// src.CreateCharacter()
// return
if(characters.len>1)
alert("You already have a character, please delete your current account and try again","ERROR!")


There any help would be very greatful as i can not go on until this is fixed.
In response to Vash_616
Vash_616 wrote:
mob/creating_character
src.CreateCharacter() //This tells the src to lookup "CreateCharacter"

I'm just going to assume that you meant to indent that under mob/creating_character/New(), since you can't call a proc like that.
In response to Goku72
Yes i know but that doesnt help me with my current problem.
In response to Vash_616
var/list/characters = client.base_CharacterNames()

Your problem would have to be in base_CharacterNames(). Whatever it's returning isn't a list. Did you copy and paste part of the base_CharacterNames() proc from the library and somehow mangle or alter it?
In response to Hedgemistress
No its a downloaded library but i didnt edit or mangle it
try
if (length(characters) > 1)
usr << alert("msg here.","Limit Reached")
return
In response to RVegeta
RVegeta wrote:
try
> if (length(characters) > 1)
> usr << alert("msg here.","Limit Reached")
> return


Don't put usr in a proc.
In response to Vash_616
Nope that didnt work either Rvegeta.
In response to Vash_616
Vash_616 wrote:
Nope that didnt work either Rvegeta.

If you're not going to view posts in threaded mode, be absolutely sure you're replying to the right post. In this case you didn't.

Lummox JR
In response to Lummox JR
2 Days Bump.
You need to define the characters var as a list.

You probably have:
var/characters

You should have:
var/list/characters

Since the len var only exists on /list objects.
In response to Foomer
Foomer wrote:
You need to define the characters var as a list.

You probably have:
var/characters
You should have:
var/list/characters
Since the len var only exists on /list objects.

See http://developer.byond.com/forum/ index.cgi?action=message_read&id=259220&forum=8&view=0

It appears to be var/list/characters
In response to Vash_616
Everytime i post a problem, no seems to help find a solution =/
Page: 1 2