acct.AddCharacter(0)

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

acct.AddCharacter(0)

Post by OldnGrey »

I am using acct.AddCharacter(0) in a start_script called from the internal www server to create a default character for a new account.

It works, but there is an error if I try to delete the character.

This is the relevent part of the script used to create the new character:

Code: Select all

program create_character(acctname)
	var acct := findaccount(acctname);
	var slot := acct.AddCharacter(0);
	var newchar;
	if ( slot )
		newchar := acct.getcharacter(slot);
		SetName(newchar, acct.name);
	endif
endprogram
You cannot delete the character until the shard is restarted or you have logged on as the new character. If you try to delete it the error text is that that character is in use.

I tried deleting it from the client login and also using acct.deletecharacter(charnum)
No dice.

Could this possibly be an 097 core bug or am I doing something wrong?
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

Here is what I suspect is happening:

Since AddCharacter is most likely used when there is an active login, POL assumes the character is logged in.

I'd try disconnecting the account using DisconnectClient and pass a reference to the newly created character as the parameter in that function call. Then wait five minutes to allow for the possibility of a delayed logout condition. Then see if you can delete the character. If so then I'd bet dollars to donuts that POL is assuming an active logged client on that character.

Not sure if I am correct but that's how I'd start tracking down the problem. Anyway, maybe the devs have a different answer.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

No it's not online, but in use somehow. I'd say the character was 'reserved'!

But just to check, I tried disconnectclient, but no go. (I even tried detach, and releaseitem!)
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

Very odd that.

Hopefully the devs will know what is happening.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

Still can't delete a newly added character. I will assume this is a bug and repeat my problem in the bugs forum. Hopefully it won't be lost then when it comes time to work on the core.
Post Reply