ID:179419
 
I'm still having trouble finding a loading code with
Deadron's character handling lib, where each mob get's located to an "area" when they load.

If you are reading this Deadron, will you soon update your lib ?
Cravens wrote:
I'm still having trouble finding a loading code with
Deadron's character handling lib, where each mob get's located to an "area" when they load.

If you are reading this Deadron, will you soon update your lib ?

I still need to get to your earlier message...all my time has gone into working on Birdland. Could you zip up your code and send it to me? That will make it easier for me to find the problem and will prompt me to get it taken care of.
In response to Deadron
Well, here is the code you gave me:

client
base_LoadMob(char_name)
var/mob/the_mob = ..()
if (the_mob)
the_mob.Move(locate(/area/start1))


Each time I load the mob, I get these errors:

runtime error: Cannot execute null.base CharacterNames().
proc name: ChooseCharacter (/mob/BaseCamp/ChoosingCharacter/proc/ChooseCharacter)
source file: implementation.dm,103
usr: ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter)
src: ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter)
call stack:
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacter()
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacter()
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Login()


If there's another way to make a locate code, I could try it.

Thx.
In response to Cravens


If there's another way to make a locate code, I could try it.

This is a lot more barbaric but:
usr.loc = locate(/area/start1)
In response to Cravens
Cravens wrote:
Well, here is the code you gave me:

client
> base_LoadMob(char_name)
> var/mob/the_mob = ..()
> if (the_mob)
> the_mob.Move(locate(/area/start1))

Each time I load the mob, I get these errors:

I created a new project and pasted in exactly that code, and didn't get any errors.


runtime error: Cannot execute null.base CharacterNames().
proc name: ChooseCharacter (/mob/BaseCamp/ChoosingCharacter/proc/ChooseCharacter)
source file: implementation.dm,103

What's being called there is:

client.base_CharacterNames()

So that means the client is null, which is not possible if there is a player hooked up to it...are you calling this for a mob that doesn't have a player attached?
In response to Exadv1
Exadv1 wrote:
This is a lot more barbaric but:
usr.loc = locate(/area/start1)

Have to use src here, not usr. Usr is the last player to use a verb or click something.

Lummox JR
In response to Deadron
Maybe there's a problem with my login code...
I made it based on your character handling demo.
Here's a small part of it:

#include <deadron/characterhandling>

client/base_num_characters_allowed = 2
mob/base_save_location = 0

world
mob = /mob/create_character

mob/create_character
base_save_allowed = 0

Login()
spawn()
src.CreateCharacter()

proc/CreateCharacter()
var/prompt_title = "New character"
var/help_text = "Name?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)
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

var/list/classes = list("Warrior", "Warlock")
help_text = "Which class would you like to start with?"
default_value = "Warrior"
var/char_class = input(src, help_text, prompt_title, default_value) in classes

var/mob/new_mob
switch(char_class)
if ("Warrior")
var/list/icons = list("Warrior1","Warrior2")
help_text = "What do you want to look like?"
default_value = "Warrior1"
var/char_icons = input(src, help_text, prompt_title, default_value) in icons
switch(char_icons)
if("Warrior1")
var/list/color = list("Red","Green")
help_text = "Which color?"
default_value = "Red"
var/char_color = input(src, help_text, prompt_title, default_value) in color
switch(char_color)
if("Red") new_mob = new /mob/Warrior/red1()
if("Green") new_mob = new /mob/Warrior/green1()
if("Warrior2")
... //Same thing here for the other classes.

new_mob.name = char_name
src.client.mob = new_mob
var/turf/first_location = locate(/area/start1)
new_mob.Move(first_location)
del(src)


Oook.. and that's just a small part of it...
Anyway, if there's a problem, it has to be in here somewhere
because I haven't touched your lib.

Thx.
In response to Lummox JR
True -- however, in rare cases (like Login()), usr is also defined for you automatically without any input from the user.
In response to Spuzzum
Spuzzum wrote:
True -- however, in rare cases (like Login()), usr is also defined for you automatically without any input from the user.

But since in that case src will work fine, why go for the mysterious invisible variable?
In response to Deadron
Yeah, I never use usr in Login(). Just pointing out something that could actually be harmful to a newbie just for the heck of it. =)
In response to Spuzzum
Yes..."EVIL USR" comes to mind.
In response to Cravens
Is it possible that the Character Handling Lib doesn't work
because my project isn't in the BYOND folder ?
It's in C:\Project instead of C:\Byond\Bin\Project .

Thx.
In response to Cravens
Cravens wrote:
Is it possible that the Character Handling Lib doesn't work
because my project isn't in the BYOND folder ?
It's in C:\Project instead of C:\Byond\Bin\Project .

Thx.

No.