PDA

View Full Version : The Unnamed Portrait



Meliora
September 24th, 2007, 17:15
Been working on the Character sheet for a little bit now, and as the noob, I probably damage way more than gaining, so you guys will see me often here :o .

One thing I did, was in the over view frame (the one with name, age, race etc), I changed a couple of things. One thing I did, was to change NAME to CHARACTER NAME. I found that it gave problems in the mini sheet for HP, which have a field for the name, but that was easilly fixed. But now I have a problem when a player logs in and create a PC. The portrait do not change its title to the character's name, but it remain - unnamed -, after a character sheet have been filled out.

I have been searching the different files, but have not been able to find the problem. Any directions to where I have to look to find the line that is attached to the title under the portrait?
Also what should I search for to find all the lines a labeledstring is attached too?

As always...thanks for any help.

joshuha
September 24th, 2007, 18:47
Check all the identityselection LUA files. Although for things like name, its always best to just change the label and not the field name in the DB otherwise you get a cascading list of places you have to fix everything.

Meliora
September 24th, 2007, 19:15
Ahhh, yes. I just changed the label to "character name" and I still got the result I wanted. (reason for that choose is because of possibility for Alternative Identity, but that is another story).

Now, I do wonder for future reference, how to find related scripts. I did, before I asked here, do a search for "name" in both .lua and the .xml files, but of course the result I got back was many, and I assumed some of those lines was related to something else than just what was in the character over view.

Let's say I have this:


<labeledstring name="unique text">

What would be the easiest way to identify scripts and other .xml files this name is attached too, so if I was to change it to "common text", I could just go around and change those files, from "unique text" to "common text" and the program would act as normal, only with a slightly change of name code? (hope it makes sense)

Again thanks for the advice to just change the label. Now I'm just looking for getting a bit more enlighted in how it is all build up, so I easier can find my way around.

Meliora
September 24th, 2007, 20:26
I did settle with just changing the label, but I wanted to learn a bit more, so I started to look into the .lua files a bit more, and found that if I searched on


("charsheet", "name",

I got only a couple of files. I went back into my charsheet_main.xml and changed <labeledstring name="name">, back to <labeledstring name="character name">, and in each of those .lua scripts I changed the "name" to "character name" and now it seem like I got the result I want.

Toadwart
September 24th, 2007, 20:51
Unfortunately I don't think there is any easy way to identify all the places a fieldname has been referenced.
I'd start out searching for "name", 'name' and .name which should find most of them (though you will also find a lot of unrelated references)

Then I'd handle any specific errors like the local character creation by tracking down the code that is doing portrait manipulation - initially searching for 'portrait' to find xml / lua files that manipulate it and tracing back through the code to the problem area.



Finally: it might not be a good idea to use a name with spaces in it like "character name". A field can be referenced in two ways: window["fieldname"] or window.fieldname. The second way will not work if there is a space in the field name. (window.character_name would be fine)

?? any lua gurus out there know if there is a way to handle names with spaces in them? window.[field name] maybe?

Foen
September 25th, 2007, 07:16
From a Lua perspective, I think parent.childname is 'syntactic sugar' (to use the words from the good book) for parent("childname") - that is attributes are just members of an associative array.

I confess to not having tried it though, and the FG objects might behave differently. Finally, even though Lua might cope, I'm not sure how the DB would work. Named control fields on the sheet automatically become DB fields which are xml elements having the same name. An xml element cannot have a space in it.

I'd run with Toadwart's advice and steer clear of spaces in field names.

Stuart

Meliora
September 25th, 2007, 11:29
I'm taken your advice, letting the label be "character name" and everything else "character_name". I did play around quite a bit with c++ once (on an amateur level), and the same was true there.

Again thanks for helping this newbie out. I know I will be back with more later :o

Meliora
September 25th, 2007, 12:23
Last update on this small project:

I'm going with joshuha's advice to just change the lable in charsheet_main.

To change "name" gives a lot of trouble all around the program and for something of so little use (and the effect I really just want, just need a label change), seem a bit of wasted time to find all the files it is related too (ran into trouble in the combat tracker).

Maybe I will return to it at a later time, for the simple reason that if I could change everything that is related to the character's "name", to a more uncommon choice of words such as "character_name" it would be easier to find the files to change. But right now, I would rather move on to some more interesting projects such of change of the hitpoint system and abilities.