PDA

View Full Version : onDrop in Personnalities



Nilliom
July 8th, 2007, 00:56
I changed the NPC to save new informations. They are contained into fields that have a different source than the field on the sheet.

When they are copied into the Personnality tab from the Library the nw attributes are not copied.

I would like to know how I can get the window that is created by the current code of the onDrop for the NPC so that I can add in this window the new values coming from the dragInfo.

Hope you can help.

Thanks in advance.

Foen
July 8th, 2007, 07:57
Hi

I think you should edit the <acceptdrop> element in the npclist windowclass. This is found in adventure_npcs.xml.

Cheers

Stuart
(Foen)

Nilliom
July 8th, 2007, 15:14
I had already done that. I added the <field>*</field> that say to transfer all fields.

But I still have some fields that are not transfered. All these fields are fields that are mapped through the source attribute ie.

<numberfield name="intelligence" source="attributes.intelligence">
...

These are not bringed back. Also I have some others structures like the weapons and other stuff that I changed form a single field to a list and they are not loaded either.

I imagine that I need to implement some scripting to allow for the setup of these new fields, but I don't know how to attach myself to the script that is already loading through the <acceptdrop> <field> thing.

Thanks

Foen
July 8th, 2007, 15:38
I must confess, I wasn't aware you could use a wildcard to specify all fields, using FGII is a constant learning experience!

You might want to sneak a look at the code in the combat tracker: scripts/combattracker.lua and scripts/combattracker_entry.lua. These scripts use the onDrop event to copy NPC data to the tracker, including data with the source attribute set (such as hp.total and hp.wounds). Beware that the setLink calls establish an updating link back to the source, so you probably just need to use getValue and setValue.

Cheers

Stuart
(Foen)

Nilliom
July 8th, 2007, 19:33
yes, I had already taken a look at the cobat tracker. The problem is that it only add the values that it need (around 10), so it create a new window and add the value that it need.

Me I want to do a full copy of the NPC, does it means that I have to override all that is already done by the <acceptdrop> and implement the copy of ALL fields in a window I will create, OR can I just piggy back on the actual copy and just had a couple or more fields into the script on teh onDrop?

Thanks

Foen
July 9th, 2007, 06:15
Hmm, I'm not sure: I've always used one method or the other. Why not try using acceptdrop with just the one or two extra fields in the script, and post back the outcome?

I have had difficulty with diefields and formattedtextfields, so if you have any of those then there could be added complications.

Cheers

Stuart
(Foen)