1
2
May 9 2004, 6:48 am
In response to Vash_616
|
|
Bump Again.
|
In response to Vash_616
|
|
Use <code>length(characters)</code> instead of <code>characters.len</code>
If the length is always zero, then one of two things is happening: EITHER: - base_CharactersNames is not returning a list. To test this, stick in <code>world << characters</code> on the line just after you call base_CharacterNames(). If the output is *not* "/list", then this is the problem. OR: - It is returning a list, but the list is empty. |
In response to Crispy
|
|
Ok crispy that works but not the way i want it to. mob/creating_character I want it so when you create 1 character you cant make another and it givesu the warning sign, if(length(characters)) |
In response to Vash_616
|
|
I see now a new problem then the original eh? i thought you still needed help with that undefined var as did everyone else.
|
In response to XzDoG
|
|
Yes that was my mistake now if anyone can help now that would be great because as i believe i said i cant move on with my game until this is done ive been stuck for days!
|
In response to Vash_616
|
|
Bump!
|
In response to Vash_616
|
|
There is a nifty article on Byondscape about something called 'Markers'. Check it out. Then run some tests on your code. Basically, you want to ask your code questions about the 'characters' var.
Is this var a list? Is this var null? If it is a list, what does it contain? If it is not a list, and it is not null, what the heck `is it? Determining what exactly the var characters is at the time you are trying to use it will help you greatly in trying to fix the problem. |
In response to Flick
|
|
The character var is supposed to be all your characters or key because i want it to make it so you can only create one character so i made the var characters to respresent you at the loading screen and tell the game you already have a character, hope that made sense.
|
In response to Vash_616
|
|
Well done, you completely failed to understand what Flick was saying. =) He means that you should ask your code what "characters" actually is, not that he was asking for you to tell him what "characters" is meant to be.
|
In response to Garthor
|
|
var/list/characters = src.CharacterList()
it still doesnt do what i want it to O_O |
In response to Crispy
|
|
Bump!
|
In response to Vash_616
|
|
Vash_616 wrote:
> var/list/characters = src.CharacterList() it still doesnt do what i want it to O_O And you still don't know what the characters var contains. Try putting this just under that line of code: world << characters Alright, that might be a bit of overkill, but the point is: I don't want to know what you think the characters var is, I wan't to see what it actually is at the time you are using it. Many times, your perception of what the program should be diong is vastly different then what is really happening. Finding out what the true value of a var is can be invaluable to figuring out whats wrong with your code. |
In response to Vash_616
|
|
/list characters is not null |
In response to Vash_616
|
|
Bump.
|
In response to Vash_616
|
|
Well there you go. "characters" appears to be an empty list, which is why its length is zero. It's probably because you have no saved characters. So you need to change your code so that it does something sensible when you don't have any characters.
If you do have saved characters, then you're most likely not saving them how the library expects. |
1
2