ID:146703
 
Code:
    ProcessForm()
/*
This is called when the player submits the form.
Make sure everything is valid; if not, send them back to the
form with an error message.

If everything is okay, create their character and log them
into it, then blank out the web page.

This checks the ckey() version of the name they chose, to make
sure it has actual letters and isn't just punctuation.
*/

var/mob/creating_character/player = usr

var/ckey_name = ckey(name)
if (!ckey_name || ckey_name == "")
player.error_text = "Your name must have alpha-numeric characters in it!"
DisplayForm()
return

// Everything is okay, so create the new mob based on the class they chose.
var/mob/new_mob
switch(class)
if ("Warrior") new_mob = new /mob/Warrior()
if ("Priest") new_mob = new /mob/Priest()
if ("Paladin") new_mob = new /mob/Paladin()
switch(hair)
if ("Warrior")
usr.overlays+= "WarriorHair.dmi"
if ("Mage")
usr.overlays+= "MageHair.dmi"
if ("Bald")
..()


Problem description:Im having a problem with the demo, i reconfigured everything perfectly except this won't work. Somehow it doesn't overlay the hair on the base icon, i don't see what i did wrong.

For one thing the
            usr.overlays+= "WarriorHair.dmi"


should be like this

not the '     ' around them instead of the "     "

[edit]
Note: also since it is defining the user in the character creation, u should do it like this.
            src.overlays+= 'WarriorHair.dmi'

with the src. instead of usr.
In response to ElderKain
ElderKain wrote:
[edit]
Note: also since it is defining the user in the character creation, u should do it like this.
>             src.overlays+= 'WarriorHair.dmi'
>

with the src. instead of usr.

He is using htmllib, src won't work in this case. :P
usr.overlays+='WarriorHair.dmi'
In response to Asohtra
Ok, i replaced the " with the '. But somehow it still refuses too overlay the hair. Il add another piece of code.

    var/mob/creating_character/player = usr

var/page = {"<body bgcolor=white>
<center><img src="logo_sword.jpg"></center>
<font color=red><b>
[player.error_text]</b></font><br>
<table>
<tr><td><b>Name:</b></td><td>
[name]</td></tr>
<tr><td>&nbsp;</td><td>&nbsp</td></tr>
<tr><td><b>Gender:</b></td>
<td>
[gender_1] Male<br>
[gender_2] Female
</td>
<tr><td>&nbsp;</td><td>&nbsp</td></tr>
<tr><td><b>Class:</b></td><td>
[class]</td>
<tr><td><b>Hair:</b></td><td>
[gender]</td>
<tr><td>&nbsp;</td><td>&nbsp</td></tr>
<tr><td>&nbsp;</td><td>
[submit]</td></tr>
</table>
"}

return page


This code is above the proc "Processform()". I think somehow it doesn't call the "switch" for the hair or the overlay just isn't working.
Superchoson wrote:
Problem description: Im having a problem with the demo, i reconfigured everything perfectly except this won't work. Somehow it doesn't overlay the hair on the base icon, i don't see what i did wrong.

You abused usr in a subtle way. It is correct in ProcessForm(), since the library was designed for client/Topic() to call this proc. However, in this proc you have two mobs to work with: the old and the new. One is usr, which is the old mob and will not be used after the character creation is finished. Another is new_mob, which is the one you actually want to add overlays to.

You're adding overlays to the wrong mob. usr is the old mob, and any overlays you add will never be seen once it's deleted.

Lummox JR
In response to Lummox JR
Thank you Lummox. I changed it according too your explanation.

new_mob.overlays += 'WarriorHair.dmi'


I understand it now, Thanks again Lummox :)
You can't have usr. If you are making the new_mob = the usr and then deleting the usr the overlays you have given the usr can never be seen. You must give them to the new_mob. E.G. new_mob.overlays += 'theicon.dmi'

In response to Gamedestroyer
I believe the problem was already solved, but thanks anyway.