PDA

View Full Version : Modifier List Extension



Oberoten
January 27th, 2009, 10:35
I have an idea here, but I think I should bounce it of a few people before going further...


It it possible to add a graphical element to the basic small windowlists. Like per example a number bubble?

I'd love to have a list for players to drag modifiers from. Like "Medium Rang" "Short range" "Dark -4" "Pitch Black -10" "Headshot -8" etc?

Preferable it should be taking the number value only if you drag from the list and then drop it into modifiers or be double-clickable and thus sending to the modbox...

Anyone else looked at this?

- Obe

Tenian
January 27th, 2009, 11:43
I toyed with it for a while...but attempted to make it too complex. The problem comes in storing/adding new modifiers. You could build a module for them, otherwise you would need to build an in game interface to manage them (and probably export them). The other option I suppose is to build a static list but that seems rather limited...even with foul extensions.

Your windowlist could consist of a graphic, a stringfield, and a number. You can alter the drag handler (onDrag I believe) for all three of those elements to set the numberdata to be the numberfield and the description to be the stringfield. I'm not sure what types the modifier box accepts but you can set the type of dragged data as well.

The real challenge is maintaining the list.

Oberoten
January 27th, 2009, 22:36
I actually have a extension allready doing something similar for vehicles. I can as a GM alter then and all (only can't let the players do the same for some reason.) But for a list of modifiers I think it'd be a VERY nice solution.

- Obe

Oberoten
January 28th, 2009, 08:58
Hmmm .... Okay? I think my mind might have locked down into a rut somewhere here. But for some reason I can't get the list to show the modifier and this is a bit too slow to use if it has to open a small note for each of the modifiers to see the contents.



<windowclass name="modsmall">
<sizelimits>
<minimum>
<height>10</height>
</minimum>
</sizelimits>
<playercontrol />
<sheetdata>
<windowreferencecontrol name="open">
<bounds>0,0,20,20</bounds>
<icon>
<normal>button_openwindow</normal>
<pressed>button_emptytarget</pressed>
</icon>
<class>mod</class>
<description>
<field>name</field>
</description>
</windowreferencecontrol>
<linkstringfield name="name">
<bounds>25,1,-20,20</bounds>
<empty>&#171; New modifier &#187;</empty>
<selectioncolor>#90ffffff</selectioncolor>
<font>sheettext</font>
<linktarget>open</linktarget>
</linkstringfield>
<linknumberfield name="bonus">
<bounds>125,1,-1,20</bounds>
</linknumberfield>
</sheetdata>
</windowclass>

Tenian
January 28th, 2009, 11:35
I'll see if I can't crank it out during lunch. It's very similar to a portion of code I wrote last week that made effects draggable to the 4E ruleset combattracker and tokens (well GM can do tokens...players can't until the onDrop handler gets fixed).

Oberoten
January 28th, 2009, 12:13
Many thanks. :)
... Hmmm. :) I do believe a small change to my code is aproperiate. :)

https://oberoten.dyndns.org/thank.png

Tenian
January 28th, 2009, 17:44
Okay a few things:

1) I have no clue how to make an extension or do anything extension related. I remember looking for it in the Library and not finding anything. So mine is built to add onto 4E. But it doesn't use any special 4E templates etc so you should be able to port it to whatever.

2) The modifiers are in a module. I've never tried to add anything to the database directly (I've changed character sheets etc). So I have no clue how to make a new "Modifier" node to the database, not to mention you'd probably want to have them exportable and all that other goodness. The module is pretty straight forward.

3) There has got to be a better way to modularize the onDrop code. I'm sure there's a way to build a handler and tell the controls to use that handler, but that's beyond the scope of what I've done before. So I just duplicated the code 3 times. Yeah I know it's bad. Foen or someone with skillz will post how to fix it! The code block is:

function onDrag(button, x, y, draginfo)
local modname = window.name.getValue()
local modvalue = window.modvalue.getValue()
if modname ~= "" and modvalue ~= "" then
draginfo.setType("number");
draginfo.setDescription(modname);
draginfo.setNumberData(modvalue);
end
return true
end


4) The module's definition file is for the 4E_JPG ruleset. I'm guessing you'll change that

5) It's spelled modifier not modifer. Remember this and you'll cut your coding time in half over what I did. :)

6) eh maybe I should have done alternating row shading. It's not hard to add.

Step 1: Add a line to graphics.xml for the modifier graphic. In this case I used a big + sign I had laying around. Make it whatever you want


<icon name="indicator_modifier" file="icons/button_expand.png" />


Step 2: Add a line to the reference.xml to point to reference_modifiers.xml which holds all the modifier classes.


<includefile source="reference_modifier.xml" />

Step 3: add the reference_modifier.xml to your ruleset directory (see attached for file)

Step 4: add the modifier.mod to your modules directory (see attached for file)

Step 5: Alter the common.xml and definitions.xml as needed.

Step 6: The modifiers should appear in your library, opening the window will present you with the sub groups. Clicking on a sub group will expand it and show you the individual modifiers.

Step 7: Drag and drop for profit!

Tenian
January 28th, 2009, 17:47
PS Let me know if you can't figure out the module structure...I think it's pretty basic but I can clarify it if needed.

Oberoten
January 29th, 2009, 08:01
I went with this instead : https://oberoten.dyndns.org/ext/Modifiers.ext

It'll load under most any ruleset and lets you keep modifiers around for later. Once the GM shares a mod all the connected players gets it on their list as well. And you can doubleclick the value to send it directly to the modifier box for your next roll.

Many thanks for the suggestions anyway. :) They'll help me create a standard library of modifiers for the reference as well.

- Obe

Spyke
January 29th, 2009, 09:25
Thanks Obe, that works well and should be useful.

Would you be able to make it so that you could drag the grey box to the modifier box to set the value, as well as double-clicking on the value? I spent a while trying to do this as it seemed intuitive. There's no visual cue that you should double-click, you see.

Spyke

Oberoten
January 29th, 2009, 10:59
Thanks Obe, that works well and should be useful.

Would you be able to make it so that you could drag the grey box to the modifier box to set the value, as well as double-clicking on the value? I spent a while trying to do this as it seemed intuitive. There's no visual cue that you should double-click, you see.

Spyke

I will take a whack at that when I come home today. Afternoon I am afraid is for heading to the hospital to check how well my face has healed up.

- Obe

Tenian
January 29th, 2009, 11:29
I believe all you'd need to add is:


<script>
function onDrag(button, x, y, draginfo)
local a = window.getDatabaseNode().getChild("bonus").getValue()
local b = window.getDatabaseNode().getChild("name").getValue()
if a ~= "" and b ~= "" then
draginfo.setType("number");
draginfo.setDescription(b);
draginfo.setNumberData(a);
end
return true
end
</script>


to the windowreference script block, but I don't have FGII handy here at work to test it.

Spyke
January 29th, 2009, 12:17
Thanks, both of you. I hope the face turns out OK, Obe.

Spyke

Oberoten
January 29th, 2009, 21:04
And that works a charm. :)

Fixing and uploading. :)

https://oberoten.dyndns.org/cc/click.php?id=26

Is the latest version.

Enjoy.

Spyke
January 29th, 2009, 21:39
Yup. Works beautifully. Thanks. :)

Spyke

Tenian
February 4th, 2009, 22:39
I made some minor changes:

1) I altered the spacing so the number ir farther to the right. Some of my modifier names ran into the modifier number. I changed the anchoring so this won't happen.

2) I added a category control to the bottom of the window so modifiers can be better organized

3) I enabled alphabetical sorting by name.

Oberoten
February 5th, 2009, 07:05
Heh. These were things I was going to add. Many thanks. Can I put it up at the extensions repository?

- Obe

Tenian
February 5th, 2009, 11:09
Knock yourself out :)

I'd like to figure out a way to make the modifiers easier to access for players / give players the ability to create their own modifiers. Maybe they already can but I couldn't figure it out immediately.

Also, that "New" button needs to work :) It taunts me by not doing anything :)

Callum
February 5th, 2009, 16:14
Thanks, guys! Is there an easy way to change the desktop symbol to something more in keeping with the base ruleset appearance? It would also be great to have some sort of readme explaining the ways in which it can be used.

Tenian
February 5th, 2009, 16:22
The .ext file is just a zip file. Rename it and open it. You should find the 2 images in it. Just replace them, zip it back up and rename it.

Oberoten
February 5th, 2009, 17:43
Explanations and Variants on the Wiki.

I'll whip up a few alternate graphic models.

- Obe

Callum
February 7th, 2009, 11:46
Thanks for the explanation in the Wiki, Obe - it's good just to have a few lines explaining what the functionality is. I couldn't see any variants, though...?

Oberoten
February 7th, 2009, 13:03
Variants will be forthcoming.

- Obe

Oberoten
February 8th, 2009, 09:35
Variant posted here :

https://oberoten.dyndns.org/fgwiki/index.php/Modifier_Collector

Callum
February 9th, 2009, 15:23
Most excellent, Obe - thanks! I've attached my version, in which I've changed the colours of the icons a bit to more closely match the others in the default ruleset.

Leonal
February 27th, 2009, 16:30
Thanks, this looks very good.

I tried both the one at the Wiki, and Tenian's.

In Tenian's version clicking "new" didn't work and I had to right click and create new. I already had items that I had put into the original extension beforehand. I could however create new modifiers as a player after having shared the sheet. Those could not be deleted again nor shared with players or dm.

Using d20_JPG latest.

Tenian
February 27th, 2009, 16:55
My version is old. I never got around to making the new button work. I would stick with Obe's

Leonal
February 27th, 2009, 17:02
Ah okay, thanks. :)

Callum
March 3rd, 2009, 12:53
Attached is my final version, which is slightly smaller, so it sits on the desktop better with the other icons.

Leonal
March 4th, 2009, 11:16
Just tried it and it works great except the "new" button, though I can live with right clicking. Already added most modifiers anyway, and they're all nice and organized now.^^

Keep up the good work!

Tristram
March 12th, 2009, 04:27
I love this modifier extension! One question from a coding illiterate, how would I go about changing the placement of the modifier icon (the bull's-eye) to place it left of the token box rather than above it? I have a ruleset that the extension doesn't work with and I believe it is because there is no room for the icon above the token box. Just curious.

-Tristram

Oberoten
March 12th, 2009, 08:06
If the ruleset can handle extensions it should scale them in so that they fit... I am afraid that it sounds like the ruleset doesn't handle the extension icons in the default manner, meaning that it is likely it was built pre-foundation.

- Obe

Tristram
March 13th, 2009, 06:12
I was afraid it was the ruleset. Oh well. Can't have everything. Thanks for the response.

-Tristram

SpudmanWP
January 3rd, 2011, 22:21
Oberoten,
Thanks for this great extension. I do not mean to resurrect an old thread, but I have a few questions.

1. For a future version, can you make a way to share all the extensions at the same time instead of opening each one to share one at a time?

2. The shared modifiers appear on the main tab of the client, not the sub-category where they exist on the server.

3. When the clients reconnect to a game in which they have previously joined, all the previously shared modifiers are grouped on the main tab. All the other categories have disappeared and have to be recreated with the modifiers moved to their new tabs. This has to be done each time the client connects.

4. Why can't the clients create their own modifiers?

Thanks again for a great extension.

Bidmaron
February 1st, 2011, 12:24
Bump. Anyone have any thoughts on Spud's questions?