Home Technical Talk

[MaxScript] Rollout instances troubles

polycounter lvl 7
Offline / Send Message
EspiSensei polycounter lvl 7
Hi polycounters!

I'm developing a tool that load every scripts contain a subfolder (called "Pickers") and then load into the Rollout the script, in this case is another Rollout.


The problem is when I execute another instance, if you select another external script (not human), this is loaded perfectly but if you select  "Picker_Human", this new instance doesn't load the rolloout, I don't understand this case, because i force the rollout with Local variables instead of Global, because in global case if you load the second instance and select a other externarl script it loads in the first instance.

Example with local vars:



the code:
-----------------------------------------------------------------------------------------------------------------------------------------------------------

------ROLLOUT------------------------------------------------------------------ROLLOUT------------------------------------- 

-----------------------------------------------------------------------------------------------------------------------------------------------------------

(
---------------------------------------------------------------------------------------------------
-- Global Vars
---------------------------------------------------------------------------------------------------
    local DynRollFloater, DynRO_current, DynRO_old
    local rootFolder = getFileNamePath (getThisScriptFilename())
    local sourceFolder = rootFolder + "Pickers\\"
    local PickerScripts = getFiles (sourceFolder + "*.ms")
    local dynRoll_rollouts = #()
---------------------------------------------------------------------------------------------------
-- Detecing the picker scripts
---------------------------------------------------------------------------------------------------
        if PickerScripts.count == 0 then
        (
            append dynRoll_rollouts "Any script detected"

        )else
            (
                for picker in PickerScripts do
                (   
                    pickerName = getFilenameFile picker
                    filein picker
                    append dynRoll_rollouts pickerName
                )
            )
---------------------------------------------------------------------------------------------------
-- Rollout Options Rollout MAIN MENU
---------------------------------------------------------------------------------------------------

    rollout RollOptions "Main Menu" width:292 height:92
    (
    ---------------------------------------------------------------------------------------------------
    -- Interface
    ---------------------------------------------------------------------------------------------------
        GroupBox 'grp' "Modes" width:250 height:80 align:#left
dropdownList 'PickerList' offset:[15,-60] width:185 height:40 items:dynRoll_rollouts align:#left
    ---------------------------------------------------------------------------------------------------
    -- Handlers
    ---------------------------------------------------------------------------------------------------
    
        -- update interface...
        -- set-up on first run...

        on RollOptions open do
        (
DynRO_old = HelpRoll
        )
        
        on PickerList selected state do (
-- set target rollout...
                
                DynRO_current = execute(PickerList.selected as String)
                if (DynRO_old == undefined) then
                (
                    messagebox("UNDEFINED --> current:" + DynRO_current as string)
                    DynRO_old = DynRO_current
                )

            -- feedback (optional - use for debugging)...
                print ("Removing " + dynRO_old as String + " and creating " + dynRO_current as String)
                
            -- add and remove the rollouts...
                messageBox("DynRO_old :" + DynRO_old as string)
                removeRollout DynRO_old DynRollFloater
                addRollout DynRO_current DynRollFloater
                DynRO_old = DynRO_current
)
    )
---------------------------------------------------------------------------------------------------
-- Other Rollouts
---------------------------------------------------------------------------------------------------

    rollout HelpRoll "HELP"
    (
        editText 'edtxtHelp' "" pos:[8,32] width:288 height:328 align:#center readOnly:True text:" HOLI "
    )

-----------------------------------------------------------------------------------------------------------------------------------------------------------

------END ROLLOUT------------------------------------------------------------------END ROLLOUT------------------------------------- 

-----------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------
-- Create Floater
---------------------------------------------------------------------------------------------------

    --if DynRollFloater != undefined then closerolloutfloater DynRollFloater

    DynRollFloater = newRolloutFloater "Picker Main Menu" 500 800

    addRollout RollOptions DynRollFloater;
    addRollout HelpRoll DynRollFloater;
)



Thanks for all again! ^^


Replies

Sign In or Register to comment.