Filed / Tracking OpenDevice and OpenDevicePos in Dialogues.ecf don't return info [01452]

Discussion in 'Tracking / Filed' started by imlarry425, Feb 27, 2024.

  1. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    464
    Likes Received:
    339
    Build: v1.11.3 4457
    Mode: Survival, SP & MP
    Seed-id: any
    Repo: always
    Severity: serious (in ExecuteOnActive & ExecuteOnCollide especially .. pos allows unique responses/device)
    Type: Dialogues Execute
    Description: OpenDevice and OpenDevicePos in Dialogues.ecf don't appear to work. The following repo is able to use LocalStructure.GetDevice(x,y,z) with a hard coded pos but the OpenDevicePos (and likewise OpenDevice) don't return data. See console screen cap for output of execute function.

    Post announcing the OpenDevice & OpenDevicePos helpers in v1.5 ... https://empyriononline.com/threads/v1-5.97986/#post-437180

    BlocksConfig.ecf modified block def for Level4Prop2 container deco "ExecuteOnActivate" trigger
    { +Block Id: 1282, Name: Level4Prop2, Ref: DecoTemplate
    TemplateRoot: DecoBlocks2
    Class: Container
    IndexName: Container
    DropInventoryEntity: DropContainer
    LootList: 57
    Model: @models2/Entities/Decorations/LaboratoryPack/Level4Prop2Prefab
    ExecuteOnActivate: Level4Prop2 # ADDED TO TEST ExecuteOnActivate/OpenDevicePos
    EnergyIn: 1, type: int, display: true, formatter: Watt
    ShowUser: Yes
    VolumeCapacity: 500, type: float, display: true, formatter: Liter
    }

    Dialogues.ecf "Level4Prop2" state code with both OpenDevicePos & hardcode position tests
    { +Dialogue Name: Level4Prop2
    Execute: "UnityEngine.Debug.Log('Level4Prop2 Activated');<nl>var x = OpenDevicePos;<nl>string output = 'OpenDevicePos Return>' + x.ToString() + '<';<nl>UnityEngine.Debug.Log(output);<nl>var device = LocalStructure?.GetDevice<IContainer>(-1,179,-1);<nl>output = 'LocalStructure.device.VolumeCapacity Return>' + device.VolumeCapacity.ToString() + '<';<nl>UnityEngine.Debug.Log(output);<nl>"
    }

    Screen capture of console output where OpenDevicePos fails but hard coded shows this is a valid GetDevice<IContainer> target ...


    [​IMG]
     
    #1
    Myrmidon likes this.
  2. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    464
    Likes Received:
    339
    quick follow up that hopefully may help in addressing the GetDevicePos() issue ...

    Dialogue variables of type dbplayerpoipos_int are persisted in the global.db with a "state" column that is a URI with an encoding of {poiEntityId}-{devX}/{devY}/{devZ}-{pfName} ... the position of devX/Y/Z is being calculated and stored correctly for both devices and deco blocks so however that is being done in that context is a method that works. Since GetDevice(x,y,z) is a valid way to get a handle to a device (or a null for not a device) this approach may be a way to address both.

    Using URI encoding in this way could also potentially provide a way to create unique state triggers for all block of a given type that use "ExecuteOnActivate" or "ExecuteOnCollide" ... assume a block were declared "ExecuteOnActivate: MyblockTrigger" the action routine could first use a URI like "MyblockTrigger:-1/720/14" for a unique state of the block of that type at that loc and if no such trigger were found it cound fall back to "MyblockTrigger"

    (using the unreserved "-" as a URI separator works fine, but since pos can have negative values, it makes potentially parsing these more difficult than necessary)
     
    #2
  3. Taelyn

    Taelyn Administrator Staff Member Community Manager

    • Developer
    • Administrator
    Joined:
    Oct 4, 2021
    Messages:
    852
    Likes Received:
    1,354
    Hello,

    using the provided code I get the correct output


    [​IMG]
     
    #3
  4. imlarry425

    imlarry425 Captain

    Joined:
    Jan 10, 2019
    Messages:
    464
    Likes Received:
    339
    The problem that I am seeing appears to be a "fail the first time and work on activations after that" sort of thing. See the attached screen capture and the position returned.

    This link is a scenario that can repo the issue- open the box you are facing, close it, and then open it again .. then open the console and look at the debug out. I never saw it working because as soon as it failed I tried making some sort of change to the script. Modified block defn is Level4Prop2 storage. Am I missing some sort of initialization that you're expecting?

    [​IMG]
     
    #4
  5. Taelyn

    Taelyn Administrator Staff Member Community Manager

    • Developer
    • Administrator
    Joined:
    Oct 4, 2021
    Messages:
    852
    Likes Received:
    1,354
    Thank you, iam able to reproduce it now
     
    #5

Share This Page