DICE PACKS BUNDLE

Thread: Extension help

  1. #1

    Extension help

    I have successfully built an extension that uses the vehicle template and adds a desktop icon to call up the custom window. I have been able to fight through all the problems with the exception of one, and I'd appreciate any insight the experienced coders could lend.

    At first test, everything works great. However, on the main tab, where a vehicles description resides, I'm encountering a small problem.

    When adding a new item, the default empty position text displays, I can click on it and edit the test as desired. I can close down the window, bring it back up and do the same. However, if I leave the campaign and return, any items entered previously do not allow me to enter new text into the description box and the default empty position text is gone.

    If I previously entered information, I can edit it using the edit text from the menu command, but what I'm faced with is if someone doesn't enter something in the description text field during the current session, they will be locked out from doing so later on.

    Thanks ahead of time.
    GM: Savage Worlds
    Player: Savage Worlds, SW:SE, Serenity, Spycraft/Spycraft 2.0
    Times: GMT -5: Weekends, Occasional Weeknights

  2. #2
    Zeus's Avatar
    Join Date
    Mar 2009
    Location
    Olympus
    Posts
    2,658
    Blog Entries
    2
    Hey ProfMarks, its hard to say exactly what the problem is without seeing the source for your extension. Can you post up the windowclass defintion and any associated LUA scripts and well see what we can do.

    From the description you have given it might be a database node ownership issue, assuming this is a client accessible window.
    FG Project Development
    Next Project(s)*: Starfinder v1.2 Starship Combat

    Current Project:
    Starfinder v1.1 - Character Starships
    Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
    * All fluid by nature and therefore subject to change.

  3. #3
    Thanks for the help offers:

    Description window class:

    <windowclass name="hq_description">
    <sheetdata>
    <!-- DESCRIPTION
    -->
    <formattedtextfield name="text">
    <anchored>
    <top>
    <anchor>top</anchor>
    <offset>5</offset>
    </top>
    <left>
    <anchor>left</anchor>
    </left>
    <right>
    <anchor>right</anchor>
    </right>
    </anchored>
    <font>
    <normal>chatfont</normal>
    <bold>narratorfont</bold>
    <italic>chatitalicfont</italic>
    <bolditalic>chatbolditalicfont</bolditalic>
    <title>defaultstringcontrol</title>
    </font>
    <linkicon>
    <link>button_openwindow</link>
    <emptylink>button_emptytarget</emptylink>
    </linkicon>
    <selectioncolor>#FFD296</selectioncolor>
    <footer>footer_narrow</footer>
    <empty>Click to enter description</empty>
    </formattedtextfield>
    </sheetdata>
    </windowclass>


    Main window class:

    <windowclass name="hq">
    <frame>npcsheet</frame>
    <sharable/>
    <placement>
    <size>
    <width>398</width>
    <height>509</height>
    </size>
    </placement>
    <sizelimits>
    <dynamic/>
    </sizelimits>
    <minimize>minimized_npc</minimize>
    <sharable/>
    <tooltip>
    <field>name</field>
    </tooltip>
    <sheetdata>
    <!-- NAME
    -->
    <genericcontrol name="nameframe">
    <bounds>38,15,-35,45</bounds>
    <frame>
    <name>sheetgroup</name>
    </frame>
    </genericcontrol>
    <windowopencontrol>
    <anchored>
    <to>nameframe</to>
    <position>insidetopleft</position>
    <offset>13,12</offset>
    <size>
    <width>20</width>
    <height>20</height>
    </size>
    </anchored>
    <icon>
    <normal>button_openwindow</normal>
    <pressed>button_emptytarget</pressed>
    </icon>
    <class>hq</class>
    <description>
    <field>name</field>
    </description>
    </windowopencontrol>
    <stringfield name="name">
    <anchored>
    <top>
    <parent>nameframe</parent>
    <anchor>top</anchor>
    <offset>13</offset>
    </top>
    <left>
    <parent>nameframe</parent>
    <anchor>left</anchor>
    <offset>35</offset>
    </left>
    <right>
    <parent>nameframe</parent>
    <anchor>right</anchor>
    <offset>-25</offset>
    </right>
    </anchored>
    <empty>« New Headquarters »</empty>
    <font>sheettext</font>
    </stringfield>
    <genericcontrol name="hostility">
    <bounds>-66,27,20,20</bounds>
    <icon>indicator_ctffneutral</icon>
    <script> datanode = nil; function update() if datanode.getValue() == 1 then setIcon("indicator_ctfffoe"); elseif datanode.getValue() == 2 then setIcon("indicator_ctfffriend"); else setIcon("indicator_ctffneutral"); end end function onClickDown(button, x, y) if User.isHost() then if datanode.getValue() < 2 then datanode.setValue(datanode.getValue()+1); else datanode.setValue(0); end end end function onInit() datanode = window.getDatabaseNode().createChild(getName(), "number"); datanode.onUpdate = update; update(); end </script>
    </genericcontrol>
    <tokenfield name="token">
    <bounds>13,25,25,25</bounds>
    <empty>indicator_emptytoken</empty>
    </tokenfield>
    <genericcontrol name="tabcontentframe">
    <bounds>25,60,-25,-25</bounds>
    <frame>
    <name>sheetgroup</name>
    <offset>0,1,0,0</offset>
    </frame>
    </genericcontrol>
    <!-- SUBWINDOWS
    -->
    <subwindow name="description">
    <anchored>
    <to>tabcontentframe</to>
    <position>over</position>
    <offset>-15,-7</offset>
    </anchored>
    <class>hq_description</class>
    </subwindow>
    <subwindow name="combat">
    <anchored>
    <to>tabcontentframe</to>
    <position>over</position>
    <offset>-15,-7</offset>
    </anchored>
    <class>hq_combat</class>
    </subwindow>
    <scrollercontrol name="description_scroller">
    <bounds>-79,-50,45,27</bounds>
    <target>description</target>
    <button>
    <normal>button_scroller</normal>
    <pressed>button_scroller_down</pressed>
    </button>
    <invisible/>
    </scrollercontrol>
    <scrollercontrol name="combat_scroller">
    <bounds>-79,-50,45,27</bounds>
    <target>combat</target>
    <button>
    <normal>button_scroller</normal>
    <pressed>button_scroller_down</pressed>
    </button>
    <invisible/>
    </scrollercontrol>
    <scrollercontrol name="other_scroller">
    <bounds>-79,-50,45,27</bounds>
    <target>other</target>
    <button>
    <normal>button_scroller</normal>
    <pressed>button_scroller_down</pressed>
    </button>
    <invisible/>
    </scrollercontrol>
    <tabcontrol name="tabs">
    <bounds>-22,50,18,150</bounds>
    <tab>
    <icon>tab_combat</icon>
    <subwindow>combat</subwindow>
    <scroller>combat_scroller</scroller>
    </tab>
    <tab>
    <icon>tab_main</icon>
    <subwindow>description</subwindow>
    <scroller>description_scroller</scroller>
    </tab>
    <activate>1</activate>
    </tabcontrol>
    </sheetdata>
    </windowclass>
    GM: Savage Worlds
    Player: Savage Worlds, SW:SE, Serenity, Spycraft/Spycraft 2.0
    Times: GMT -5: Weekends, Occasional Weeknights

  4. #4
    and the lua:

    function onDrop(x,y,dragdata)
    if dragdata.isType("hq") then
    dropnode = dragdata.getDatabaseNode();
    return nil;
    elseif dragdata.isType("shortcut") then
    local class = dragdata.getShortcutData();
    if class == "hq" then
    dropnode = dragdata.getDatabaseNode();
    return nil;
    end
    end
    return false;
    end

    function copyhq(target)
    local newnode = target.getDatabaseNode();
    local oldnode = dropnode;
    if dropnode then
    dropnode = nil;
    else
    return
    end
    --fields
    newnode.createChild("name","string").setValue(oldn ode.createChild("name","string").getValue());
    newnode.createChild("hostility","number").setValue (oldnode.createChild("hostility").getValue());
    newnode.createChild("token","token").setValue(oldn ode.createChild("token").getValue());
    newnode.createChild("size","string").setValue(oldn ode.createChild("size").getValue());
    newnode.createChild("cost","string").setValue(oldn ode.createChild("cost").getValue());
    newnode.createChild("condition","string").setValue (oldnode.createChild("condition").getValue());
    newnode.createChild("location","string").setValue( oldnode.createChild("location").getValue());
    newnode.createChild("rooms","string").setValue(old node.createChild("rooms").getValue());
    newnode.createChild("roomlist","string").setValue( oldnode.createChild("roomlist").getValue());
    newnode.createChild("features","string").setValue( oldnode.createChild("features").getValue());
    newnode.createChild("token","token").setValue(oldn ode.createChild("token","token").getValue());
    -- attacks

    end



    function onSortCompare(w1, w2)
    return w1.name.getValue() > w2.name.getValue();
    end

    function onFilter(w)
    local f = string.lower(window.filter.getValue());

    if f == "" then
    return true;
    end

    if string.find(string.lower(w.name.getValue()), f, 0, true) then
    return true;
    end

    return false;
    end
    GM: Savage Worlds
    Player: Savage Worlds, SW:SE, Serenity, Spycraft/Spycraft 2.0
    Times: GMT -5: Weekends, Occasional Weeknights

  5. #5
    Zeus's Avatar
    Join Date
    Mar 2009
    Location
    Olympus
    Posts
    2,658
    Blog Entries
    2
    OK, given the forums have mashed the formatting, this is probably going to be easier to do if you attach your extension to a post as an attachment. I can then download it and take a look.

    BTW. I noticed a few whitespaces in the middle of variable names like old node or ol dnode instead of oldnode, I assume this if the posts formatting thats done that but thought I should check just in case.

    If you can't attach the extension, let me know and I'll PM you my email address and you can forward it that way.

    FG Project Development
    Next Project(s)*: Starfinder v1.2 Starship Combat

    Current Project:
    Starfinder v1.1 - Character Starships
    Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
    * All fluid by nature and therefore subject to change.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
STAR TREK 2d20

Log in

Log in