PDA

View Full Version : Droppable items



Phalck
December 29th, 2005, 11:20
I am creating a custom ruleset where I want for example weapons from a reference page to be droppable to the character sheet, much like the spells in the d20 ruleset. I have studied the d20 ruleset until my eyes bleed, but can still not get it to work.

Help is much appreciated. These are my code snippets:
MUA_charsheet.xml


<windowclass name="charsheet_skapavapen">
<frame name="charsheet_skapavapen" />
<datasource name="skapavapen" />
<defaultsize width="494" height="16" />
<sheetdata>
<stringcontrol name="Namn">
<bounds rect="0,0,137,16" />
</stringcontrol>
<stringcontrol name="Fattn">
<bounds rect="137,0,29,16" />
<center />
</stringcontrol>
<stringcontrol name="Init">
<bounds rect="167,0,27,16" />
<center />
</stringcontrol>
<stringcontrol name="Skada">
<bounds rect="195,0,42,16" />
<center />
</stringcontrol>
<numbercontrol name="PEN">
<bounds rect="238,0,26,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<stringcontrol name="Rackv">
<bounds rect="265,0,55,16" />
<center />
</stringcontrol>
<numbercontrol name="TAL">
<bounds rect="321,0,26,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<numbercontrol name="PALM">
<bounds rect="348,0,27,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<numbercontrol name="PAL">
<bounds rect="380,0,27,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<stringcontrol name="Vikt">
<bounds rect="408,0,30,16" />
<center />
</stringcontrol>
<Numbercontrol name="MagM">
<bounds rect="439,0,22,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<numbercontrol name="Mag">
<bounds rect="468,0,27,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
</sheetdata>
</windowclass>

<windowlist class="charsheet_skapavapen" name="charsheet_vapenlista">
<allowcreate />
<allowdelete />
<nestdata />
<bounds rect="18,522,491,112" />
<sort fields="Namn" />
<acceptdrop class="vapenbeskr" fields="Namn,Fattn,Init,Skada,PEN,Rackv,TAL,PAL,Vikt,Mag" />
</windowlist>
<scroller>
<bounds rect="6,643,45,27" />
<target name="charsheet_vapenlista" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>


The XML reference file looks like this:
vapenbeskr.xml:


<root>
<node name="vapenbeskr">
<node name="Pistol22">
<stringvalue name="Namn" value="Pistol .22" />
<stringvalue name="Eldh" value="e" />
<stringvalue name="Fattn" value="1H" />
<stringvalue name="Init" value="+10" />
<intvalue name="Mag" value="10" />
<intvalue name="PAL" value="100" />
<stringvalue name="Rackv" value="Nara/10m" />
<stringvalue name="Skada" value="1T8" />
<intvalue name="TAL" value="10" />
<intvalue name="PEN" value="0" />
<intvalue name="STY" value="0" />
<stringvalue name="Radie" value="-" />
<stringvalue name="Vikt" value="1" />
<intvalue name="Varde" value="250" />
</node>
</root>


This is the reference XML:
MUA_reference.xml:


<windowclass name="vapenlista_data">
<datasource name="vapenbeskr" />
<defaultsize width="640" height="20" />
<sheetdata>
<windowopencontrol>
<icon normal="button_dragtarget" />
<bounds rect="15,0,24,24" />
<class name="vapenbeskr" />
<description field="Namn" />
</windowopencontrol>
<stringcontrol name="Namn">
<bounds rect="39,0,230,20" />
<font name="chatfont" />
</stringcontrol>
<stringcontrol name="Eldh">
<bounds rect="230,0,32,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<stringcontrol name="Fattn">
<bounds rect="260,0,32,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<stringcontrol name="Init">
<bounds rect="290,0,32,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<numbercontrol name="Mag">
<bounds rect="320,0,32,16" />
<font name="chatfont" />
<center />
</numbercontrol>
<numbercontrol name="PAL">
<bounds rect="350,0,32,16" />
<font name="chatfont" />
<center />
</numbercontrol>
<stringcontrol name="Rackv">
<bounds rect="380,0,72,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<stringcontrol name="Skada">
<bounds rect="450,0,52,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<numbercontrol name="TAL">
<bounds rect="500,0,32,16" />
<font name="chatfont" />
<center />
</numbercontrol>
<stringcontrol name="Vikt">
<bounds rect="540,0,42,16" />
<font name="chatfont" />
<center />
</stringcontrol>
<numbercontrol name="Varde">
<bounds rect="580,0,41,16" />
<font name="chatfont" />
<center />
</numbercontrol>
</sheetdata>
</windowclass>

<windowclass name="vapenlista">
<datasource name="vapenbeskr" />
<frame name="referencebox" />
<dynamic />
<defaultsize width="640" height="550" />
<minimize icon="minimized_reference" />
<tooltip field="description" />
<sheetdata>
<stringcontrol>
<bounds rect="0,10,230,20" />
<font name="narratorfont" />
<center />
<static value="Namn" />
</stringcontrol>
<stringcontrol>
<bounds rect="230,10,32,20" />
<font name="narratorfont" />
<center />
<static value="Eldh" />
</stringcontrol>
<stringcontrol>
<bounds rect="260,10,32,20" />
<font name="narratorfont" />
<center />
<static value="Fattn" />
</stringcontrol>
<stringcontrol>
<bounds rect="290,10,32,20" />
<font name="narratorfont" />
<center />
<static value="Init" />
</stringcontrol>
<stringcontrol>
<bounds rect="320,10,32,20" />
<font name="narratorfont" />
<center />
<static value="Mag" />
</stringcontrol>
<stringcontrol>
<bounds rect="350,10,32,20" />
<font name="narratorfont" />
<center />
<static value="PAL" />
</stringcontrol>
<stringcontrol>
<bounds rect="380,10,72,20" />
<font name="narratorfont" />
<center />
<static value="Rackvidd" />
</stringcontrol>
<stringcontrol>
<bounds rect="450,10,52,20" />
<font name="narratorfont" />
<center />
<static value="Skada" />
</stringcontrol>
<stringcontrol>
<bounds rect="500,10,32,20" />
<font name="narratorfont" />
<center />
<static value="TAL" />
</stringcontrol>
<stringcontrol>
<bounds rect="535,10,42,20" />
<font name="narratorfont" />
<center />
<static value="Vikt" />
</stringcontrol>
<stringcontrol>
<bounds rect="580,10,41,20" />
<font name="narratorfont" />
<center />
<static value="Varde" />
</stringcontrol>

<windowlist class="vapenlista_data" name="lista">
<bounds rect="0,28,-20,-22" />
<sort fields="Namn" />

</windowlist>
<filter>
<bounds rect="18,-65,21,41" />
<icon name="search_icon" />
<entrymode frame="searchframe" bounds="18,-95,-80,77" textarea="37,45,-3,-12" />
<target name="lista" field="Namn" />
</filter>
<scroller>
<bounds rect="-63,-45,45,27" />
<target name="lista" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>
</sheetdata>
</windowclass>


I can drag and drop individual fields from the reference page to the character sheet without trouble, but when I drag the image, i.e., the whole row at once, it does not work.

You can also see an example here, where I would like to have Swedish characters in the value fields of the XML tags, for example I would like to write Värde instead of Varde. I have a separate post on this matter.

Help is much appreciated.

/Phalck

Crusader
December 29th, 2005, 21:59
I'm way to tired to focus on the code right now, but I couldn't help to notice that you're obviously a Swede - Cool!

Phalck
January 9th, 2006, 18:39
Yeah, I am a Swede living in the US and longing for playing Swedish RPGs. I am therefore currently working on a Mutant: UA Ruleset.

Any help on getting droppable items to work is appreciated. You dont have to look at the code above, just a quick run down on how it is achieved would be appreciated.

I think I have a problem with the datasource elements.

Thanks,
/Phalck

zambol
January 9th, 2006, 23:14
I got it working with this.

_reference.xml:


<root>
<windowclass name="referenceroot">
<frame name="referenceroot" />
<defaultsize width="480" height="498" />
<sheetdata>
<windowlist class="vapenlista" name="lista">
<bounds rect="40,50,200,400" />
<sort fields="name" />
<footer image="footer_narrow" />
</windowlist>
<filter>
<bounds rect="18,-65,21,41" />
<icon name="search_icon" />
<entrymode frame="searchframe" bounds="18,-95,-80,77" textarea="37,45,-3,-12" />
<target name="lista" field="Namn" />
</filter>
<scroller>
<bounds rect="-63,-145,45,27" />
<target name="lista" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>

</sheetdata>
</windowclass>

<windowclass name="vapenlista">
<datasource name="vapenbeskr" />
<defaultsize width="640" height="27" />
<sheetdata>
<windowopencontrol name="open">
<icon normal="button_openwindow2" pressed="button_openwindow2down" />
<bounds rect="0,0,24,24" />
<class name="vapenbeskr" />
<description field="Namn" />
</windowopencontrol>
<stringcontrol name="Namn">
<bounds rect="30,2,120,20" />
<link handler="open" underlineoffset="-2" />
</stringcontrol>
</sheetdata>
</windowclass>

<windowclass name="vapenbeskr">
<datasource name="vapenbeskr" />
<frame name="referencebox" />
<dynamic resize="vertical" />
<defaultsize width="640" height="100" />
<minimize icon="minimized_reference" />
<tooltip field="Namn" />
<sheetdata>
<windowopencontrol>
<icon normal="button_dragtarget" />
<bounds rect="10,10,24,24" />
<class name="vapenbeskr" />
<altclass name="vapenbeskr" />
<description field="Namn" />
</windowopencontrol>
<stringcontrol name="Namn">
<bounds rect="39,10,230,20" />
<font name="chatfont" />
</stringcontrol>
<stringcontrol name="Eldh">
<bounds rect="230,10,32,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<stringcontrol name="Fattn">
<bounds rect="260,10,32,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<stringcontrol name="Init">
<bounds rect="290,10,32,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<numbercontrol name="Mag">
<bounds rect="320,10,32,16" />
<font name="chatfont" />
<center />
</numbercontrol>
<numbercontrol name="PAL">
<bounds rect="350,10,32,16" />
<font name="chatfont" />
<center />
</numbercontrol>
<stringcontrol name="Rackv">
<bounds rect="380,10,72,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<stringcontrol name="Skada">
<bounds rect="450,10,52,20" />
<font name="chatfont" />
<center />
</stringcontrol>
<numbercontrol name="TAL">
<bounds rect="500,10,32,16" />
<font name="chatfont" />
<center />
</numbercontrol>
<stringcontrol name="Vikt">
<bounds rect="540,10,42,16" />
<font name="chatfont" />
<center />
</stringcontrol>
<numbercontrol name="Varde">
<bounds rect="580,10,41,16" />
<font name="chatfont" />
<center />
</numbercontrol>
</sheetdata>
</windowclass>

</root>


charsheet.xml


<root>
<windowclass name="charsheet">
<datasource name="charsheet" />
<defaultsize width="350" height="685" />
<defaultposition x="415" y="30" />
<minimize />
<nodelete />
<playercontrol />
<sheetdata>

<windowlist class="charsheet_skapavapen" name="charsheet_vapenlista">
<allowcreate />
<allowdelete />
<nestdata />
<bounds rect="18,522,491,112" />
<sort fields="Namn" />
<acceptdrop class="vapenbeskr" fields="Namn,Fattn,Init,Skada,PEN,Rackv,TAL,PAL,Vikt,Mag" />
</windowlist>
<scroller>
<bounds rect="6,643,45,27" />
<target name="charsheet_vapenlista" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>
</sheetdata>
</windowclass>

<windowclass name="charsheet_skapavapen">
<datasource name="skapavapen" />
<defaultsize width="494" height="16" />
<sheetdata>
<stringcontrol name="Namn">
<bounds rect="0,0,137,16" />
<empty value="&laquo; New Item &raquo;" />
</stringcontrol>
<stringcontrol name="Fattn">
<bounds rect="137,0,29,16" />
<center />
</stringcontrol>
<stringcontrol name="Init">
<bounds rect="167,0,27,16" />
<center />
</stringcontrol>
<stringcontrol name="Skada">
<bounds rect="195,0,42,16" />
<center />
</stringcontrol>
<numbercontrol name="PEN">
<bounds rect="238,0,26,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<stringcontrol name="Rackv">
<bounds rect="265,0,55,16" />
<center />
</stringcontrol>
<numbercontrol name="TAL">
<bounds rect="321,0,26,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<numbercontrol name="PALM">
<bounds rect="348,0,27,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<numbercontrol name="PAL">
<bounds rect="380,0,27,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<stringcontrol name="Vikt">
<bounds rect="408,0,30,16" />
<center />
</stringcontrol>
<Numbercontrol name="MagM">
<bounds rect="439,0,22,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
<numbercontrol name="Mag">
<bounds rect="468,0,27,16" />
<hideonvalue value="0" />
<center />
</numbercontrol>
</sheetdata>
</windowclass>

</root>


vapenbeskr.xml
As is.

I made it same way as i did equipment_shop to inventory drag in my own ruleset.

Changes didnt work with me until i changed "vapenlista_data" to "vapenbeskr". It might be enought for you to change just this so try that first.

Phalck
January 10th, 2006, 03:02
OMG, that did it. I changed vapenlista_data to vapenbeskr and that did it. I still dont understand the relationships between the datasource, windowclass and windowlist nodes and the node vapenbeskr in the database folder, in my case vapenbeskr.xml.

At this point I dont care, but it would be nice to have it explained at some point.

Thanks again,
/Phalck