Log in

View Full Version : Drag and Drop not working



bloodylemming
January 2nd, 2022, 19:55
I created a Window List for languages (lstLanguages), created the language item to go into it (itemLanguage) and the language description window (language), to hold all the info on a specific language.
I set this up the same as with equipment, but I can't seem to drag and drop items from the Languages sidebar window into that language list, like I can with equipment items...

For lstLanguages I have the Class Name set to itemLanguage, the Accept Drop Classes to 'item' (also tried 'language' and 'languageItem') and the Data Source set to .languageItem.
When I create a new Language entry from the sidebar menu, it comes up with my custom dialogue window (language). The same dialogue that comes up when I create a language in listLanguages...


I don't know what I missed...

Moon Wizard
January 2nd, 2022, 21:47
You should probably just use the same templates and code as the CoreRPG sheet; instead of creating your own. There is a bunch of logic built into those templates that other areas know about.

In fact, I would recommend using the CoreRPG version of the character sheet pages, and only overriding the specific ones you need to override for your system. In many rulesets, you don't need to override the Inventory or Notes sections at all...

Regards,
JPG

bloodylemming
January 2nd, 2022, 22:01
You should probably just use the same templates and code as the CoreRPG sheet; instead of creating your own. There is a bunch of logic built into those templates that other areas know about.

In fact, I would recommend using the CoreRPG version of the character sheet pages, and only overriding the specific ones you need to override for your system. In many rulesets, you don't need to override the Inventory or Notes sections at all...

Regards,
JPG

That's basically what I've done, I only overrode the layout of language, just as I did with Inventory, which works just fine. The only thing i've deleted outright was the Abilities tab, since I don't need it. I'm also creating items that aren't present in CoreRPG, like Holdings and Treasure, which aren't the same as inventory items, in this game...

bloodylemming
January 3rd, 2022, 00:28
I've gone back and redid Languages with the CoreRPG vanilla template, but I still can't drag and drop languages from the sidebar item...

damned
January 3rd, 2022, 03:14
https://www.youtube.com/watch?v=aKSiDtCdVhw

bloodylemming
January 3rd, 2022, 03:26
https://www.youtube.com/watch?v=aKSiDtCdVhw

followed that, but still cannot drag and drop languages into that field.

damned
January 3rd, 2022, 03:31
You might note I didnt create a Campaign Tool for Languages - Im using the CoreRPG languages as they have things like the chat in language features.

damned
January 3rd, 2022, 03:36
If you look in your generated content you will likely see something like:


<list_language name="language_list">
<frame>
<name>languagesframe</name>
<offset>5,20,5,20</offset>
</frame>
<bounds>205,65,180,190</bounds>
<class>char_language</class>
<datasource>.languagelist</datasource>
</list_language>


in CoreRPG you have the following template


<template name="list_language">
<list_text>
<datasource>.languagelist</datasource>
<class>char_language</class>
<sortby><control>name</control></sortby>
<newfocus>name</newfocus>
<allowcreate />
<allowdelete />
<script>
function onDrop(x, y, draginfo)
local sDragType = draginfo.getType();
if sDragType == "string" or sDragType == "language" then
local w = addEntry(true);
w.name.setValue(draginfo.getStringData());
return true;
end
end
</script>
</list_text>
</template>

if you look at another windowlist you have created with campaign tools and drag and drop you might see


<list_text name="skills_list">
<frame>
<name>skillsframe</name>
<offset>5,18,5,10</offset>
</frame>
<bounds>5,216,380,47</bounds>
<class>skills_detail</class>
<datasource>.skillslist</datasource>
<allowcreate />
<allowdelete />
<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>
<columns>
<width>180</width>
<fillwidth />
</columns>
</list_text>


in particular see


<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>

bloodylemming
January 3rd, 2022, 03:37
You might note I didn't create a Campaign Tool for Languages - I'm using the CoreRPG languages as they have things like the chat in language features.

I'd like to have a repository of languages, the players can drag and drop onto their character sheets, just like Items...

damned
January 3rd, 2022, 03:52
so see my second post above.

damned
January 3rd, 2022, 03:58
You really want to make sure that you are integrating with the CoreRPG language support too.

bloodylemming
January 3rd, 2022, 04:26
I have this


<list_language name="lstLanguages">
<anchored>
<left offset="8" />
<top offset="118" />
<bottom offset="-4" />
<size>
<width>173</width>
</size>
</anchored>
<class>char_language</class>
<datasource>.languagelist</datasource>
<allowcreate />
<allowdelete />
<acceptdrop>
<class>language</class>
<field>lstLanguages</field>
</acceptdrop>
</list_language>


I am using list_language under General>Advanced Template



<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>


This is set under Class Properties>Accept Drop Classes, correct?
I've added the class item 'language' there, but it seems that is an invalid class, or at least that's an error I get in the sidebar item...

damned
January 3rd, 2022, 05:18
See the differences between my sample code and yours


<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>

You are almost there

Moon Wizard
January 3rd, 2022, 07:46
I would really recommend for your first project that you not try to fiddle with the core objects so much. You are creating much more work for yourself, and as you learn more, you'll be able to make more edits as you figure things out.

Regards,
JPG

bloodylemming
January 3rd, 2022, 18:03
I would really recommend for your first project that you not try to fiddle with the core objects so much. You are creating much more work for yourself, and as you learn more, you'll be able to make more edits as you figure things out.

Regards,
JPG

I certainly understand the sentiment, and I know there are things I would like to do that I'm just not ready for, but for languages, right now it is vanilla, apart from my formatting, so worst case scenario, it just stays the way it is and I waste some time.

bloodylemming
January 3rd, 2022, 18:06
See the differences between my sample code and yours


<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>

You are almost there

The field entry, is that where the controlling object goes, in my case lstLanguages, or is it literally supposed to be an astrix?

Here's what's generated by Rules Wizard.


<acceptdrop>
<class>skills</class>
<field>lstLanguages</field>
</acceptdrop>

Moon Wizard
January 3rd, 2022, 18:53
If you put that value in there, it is literally looking for a database value named "lstLanguages" from any drop which is a "skills" record, which I'm thinking is not what you want. The "*" indicates to copy all fields on drop for that window display class.

If you want some specific behavior, you are better off overriding the onDrop event directly, and determining what type of object was dropped and what you want to do with it.

Regards,
JPG

bloodylemming
January 3rd, 2022, 18:56
So, it looks like the Languages sidebar item I created is not the same as the one in the Options menu. (see attached)
I can drag and drop from the Options one, but not from the sidebar one.
I assume this is how it's supposed to work, or that I set up the one in the sidebar wrong.

From dataLibrary


LibraryData.aRecords["language"] = {
bExport = true,
aDataMap = { "language", "reference.language" },
aDisplayIcon = { "sidebar", "sidebar_down" },
sRecordDisplayClass = "language",
}


From strings


<string name="library_recordtype_label_language">Languages</string>


It's working through the Options menu, so I'm good with that, but I would like to know what I did wrong...

damned
January 3rd, 2022, 21:54
If your source is .languagelist then you are using the same list

This might be generated by the Ruleset Wizard but only based on what you put in it and the values are not all correct


<acceptdrop>
<class>skills</class>
<field>lstLanguages</field>
</acceptdrop>

Look at the other examples posted

bloodylemming
January 4th, 2022, 03:36
If you put that value in there, it is literally looking for a database value named "lstLanguages" from any drop which is a "skills" record, which I'm thinking is not what you want. The "*" indicates to copy all fields on drop for that window display class.

If you want some specific behavior, you are better off overriding the onDrop event directly, and determining what type of object was dropped and what you want to do with it.

Regards,
JPG

Ah, so it is a wildcard.
I thought that value would be the name of the listwindow...
Thanks.

damned
January 4th, 2022, 04:20
<acceptdrop>
<class>language</class>
<field>*</field>
</acceptdrop>

bloodylemming
January 4th, 2022, 15:12
<acceptdrop>
<class>language</class>
<field>*</field>
</acceptdrop>

Crap. I don't think I'm getting the CoreRPG functionality.
I created two characters, gave them the same language and spoke as one of those characters, in that shared language and 'understood by' was blank...

Trenloe
January 4th, 2022, 15:23
I created two characters, gave them the same language and spoke as one of those characters, in that shared language and 'understood by' was blank...

1) Make sure you are logged in as a player with PCs selected (run a second instance of FGU and connect to the GM instance) as the language functionality is tied the currently active PCs (selected by players) only.
2) Ensure that the language name database field is exactly the same as vanilla CoreRPG so that the language code can correctly get the names of the active PC languages.