ID:271925
 
mob/creating_character
var
name
race

Login()
. = ..()
loc = null
var/Form/create/c = new()
c.DisplayForm(src)

This is the string that starts character creation >.>



var/XML/Element/create
new("player","<name>[name]</name>")
switch(race)
if(p.race = "human")
Attributes("human.xml")


This is me trying to XML-lize it. Its...not...working >.<
Any help would be greatly appreciated.
Hmmm... Your switch() should be less indented
and your Attributes() needs to be indented once.
The mob vars should be indented once.

I haven't done XML anything, so that's all I have to say.
In response to Kaiochao2536
Might have found a bug. As the code is, it points to this line for an error. Bad argument or something...


combo
var
activation_string

proc
isActivated(combo_string)


But when i // my previously stated code, it compiles fine.
In the first code listing you provided, you need to indent everything after the first line by an extra tab.

Oblivion Communications wrote:
> var/XML/Element/create
> new("player","<name>[name]</name>")
> switch(race)
> if(p.race = "human")
> Attributes("human.xml")
>

This is me trying to XML-lize it. Its...not...working >.<
Any help would be greatly appreciated.

This code doesn't make sense. new is an operator to create a new object. If you want "create" to be a new /XML/Element object, you need to be using
var/XML/Element/create = new(/* ... */)
--- Note the '=' assignment operator.

I'm not sure what you're trying to accomplish after you set create to a new /XML/Element type, either. There is no surrounding code block to evaluate, everything is indented incorrectly, and I believe that the library functions are improperly invoked.

The switch statement should be at the same indentation level as the var/statement... I think. I'm just not sure what I'm looking at with your code, to be perfectly honest.

After that, you want if(p.race == "human"), not if(p.race = "human").

I've never used this XML library, but from http://www.byondscape.com/ascape.dmb/ Deadron.2003-0517/#HTMLifier_31 I suspect that you need to be doing more than calling Attributes("human.xml"); perhaps you should be assigning it to some list:
var/list/attributes = create.Attributes()
// I suspect this to be the intended format, based on the article


That's all I can provide with what I have to look at, so I leave it up to you to fix the aforementioned errors and hopefully find some meaningful context for your second code listing.

As always, it is important that you learn DM before trying to make games in it. The DM Guide is the standard source of learning, but I also recommend reading through demos such as hub://deadron.stepbyond and hub://dantom.yourfirstworld after reading a few chapters of the DM Guide.

Hiead
In response to Hiead
Still lost as hell. All I want to do is create the character. When someone for example selects human, it calls the DMI and for stats it calls the XML file. I have no clue how to do that. Please help.
Oblivion Communications wrote:
Still lost as hell. All I want to do is create the character. When someone for example selects human, it calls the DMI and for stats it calls the XML file. I have no clue how to do that. Please help.


Can anyone help me?