[Solved] Maintain Action text until action is performed

  • #1, z marco-roncoMonday, 12. June 2017, 22:45 hodinky 7 years ago
    Hello smile

    My name is Marco and I'm working on my first graphic adventure with Visionaire.

    I have made a SCUMM interface from scratch, learning a little bit of LUA and Visionaire Studio commands.

    If you wish, please check this video: https://vimeo.com/220475028/97f35289cf
    (This video is in Italian, English translation will be available as soon Italian version has finished)

    ========= UPDATE =========
    If you are interested, you can see the solved script here https://www.visionaire-studio.net/forum/thread/-solved-maint...
    =======================

    By the way, I have a simple problem:
    I need the action text not to change until the action is performed.

    Right now Visionaire display action text dinamically and resets it immediately after the click.

    I tried a "wait until character stop" action, but this way the action text will remain until the character reaches destination, NOT until the action has been performed.

    I'll try to explain by code:

    Actual Visionaire Studio Default Action Text Handling:

    function SCUMMActionText(mousePos)
    
        local obj = game:getLink(VGameCurrentObject)
        local verb = game:getLink(VGameActiveCommand):getTextStr(VButtonName)
        local obj_name = obj:getTextStr(VObjectName)
    
        if obj:getId().tableId == null then
           return verb
        end
    
        if obj:getId().tableId == eObjects then
          return verb
        end
    
        if obj:getId().tableId == eObjects then
          return verb .. ' ' .. obj_name
        else
          return verb
        end
    
    end
    
    registerHookFunction("getActionText", "SCUMMActionText")    


    What I would like to achieve

    If a command is not set, just act as above.
    if obj:getId().tableId == null then
     return verb
    end

    Now the part I cannot implement.
    If a command is set, (eg "Use") and then an object exist (Item, Character, Scene Obj)
    
    return verb + object (eg Use the chair) as above.
    
    IF command is set + object exist AND left mouse is clicked
    
    return verb .. ' ' .. obj_name EVEN if the mouse exits the object area, until action is performed.
    

    I just need an action text a-la-Monkey-Island, where the action text remains unchanged until the action is performed:

    https://youtu.be/RZeGaZUJOqc?t=28m16s

    In Visionaire action text is changed when you move the mouse outside the object (even if a command + click on object is set).

    I have also added a "wait until character stops" block on the code: in this case the action text remains until the character is at destination, but when the action is performed (Eg. Use Mechanism with Machine), the action text auto-resets to "Walk to" (default) before the action is completed.

    If anyone could help me I’ll really appreciate it.

    Bažant

    22 Posts


  • #2, z gabartsTuesday, 13. June 2017, 15:37 hodinky 7 years ago
    I had the same problem configuring this and didn't manage to solve it. Even if I switched to another method i'm interested in solve this thing too. In fact is annoying to see the action text not working properly.

    Fanoušek fóra

    137 Posts

  • #3, z afrlmeTuesday, 13. June 2017, 15:53 hodinky 7 years ago
    There's an option in the main game settings tab (cog icon) which you can use to determine when standard command should be set. If you set to "never" or "only after successful execution" then it should remain until after the actions have been performed, though it will likely be hidden if you trigger a begin/end cutscene or hide/show cursor event.

    @gabarts: the issue for you is the way you have setup your interactions. You have actions being executed in mouse properties tab for both left & right mouse click & you are using some called by other actions for triggering interactions with scene objects as far as I can tell. Not the most conventional way to go about sorting out interaction events.

    Imperátor

    7285 Posts

  • #4, z sebastianTuesday, 13. June 2017, 17:51 hodinky 7 years ago
    I dont get exactly what you are searching for. 

    If you want the selected action text/command to reset/not reset after (successfully) using a specified command you can set it as mentioned by AFRLme mentioned in the game settings.

    Im also not quite sure why to use Lua here because the "normal" way to achieve this would be doable without a single line of Lua (if I understand it correctly)...

    PS: on thursday, 16:00 CEST i will post a tutorial for a scumm menu on youtube (see my profile). Even if its german, maybe you find the answer there .

    Kapitán

    2346 Posts

  • #5, z gabartsTuesday, 13. June 2017, 18:31 hodinky 7 years ago
    @AFRLme
    I've completely smoothen up my template now, that was the template which I started with, a real mess, especially under the left and right mouse click events (which now I've cleaned up as you suggested). I'm using in fact "only after successful execution" but I don't know if this can solve the problem for Marco.

    Now I have draw text at cursor and only 1 action for left mouse click (to reset to walk to command whenever player click areas without hotspots, so resetting the action).

    Fanoušek fóra

    137 Posts

  • #6, z MachtnixTuesday, 13. June 2017, 19:02 hodinky 7 years ago
    If you wish, please check this video: https://vimeo.com/220475028/97f35289cf
    (This video is in Italian, English translation will be available as soon Italian version has finished)
    I like it. For which age (figur looks "kawai"...)?

    Kapitán

    1097 Posts

  • #7, z marco-roncoTuesday, 13. June 2017, 19:50 hodinky 7 years ago
    Hello everyone, thanks for the reply smile

    I've probably explain the problem in a wrong way, sorry for my bad English.

    @AFRLme @Sebastian
    I've tried that option, but I need the action text phrase only to stay there until the action is performed, even if I move the mouse cursor outside the object. Please take a look to the video:


    You can see what happens with "Never" and "Always", then at 1:09 minutes You
    can see how Monkey Island manage the action text.

    I'm trying to obtain the "Monkey Island" style action text.

    @Sebastian
    Cool! Your video tutorial will help me a lot, I'll watch it for sure, many thanks smile

    @Machtnix
    Like Monkey Island 1&2 so I think is rated E. It is not a child game, but the game is making fun of Anime cliches, Adventure Graphic cliches and citation, in a personal style. I hope you like it smile

    Bažant

    22 Posts

  • #8, z sebastianTuesday, 13. June 2017, 20:25 hodinky 7 years ago
    Hello everyone, thanks for the reply smile

    I've probably explain the problem in a wrong way, sorry for my bad English.

    @AFRLme @Sebastian
    I've tried that option, but I need the action text phrase only to stay there until the action is performed, even if I move the mouse cursor outside the object. Please take a look to the video:


    You can see what happens with "Never" and "Always", then at 1:09 minutes You
    can see how Monkey Island manage the action text.

    I'm trying to obtain the "Monkey Island" style action text.

    @Sebastian
    Cool! Your video tutorial will help me a lot, I'll watch it for sure, many thanks smile

    @Machtnix
    Like Monkey Island 1&2 so I think is rated E. It is not a child game, but the game is making fun of Anime cliches, Adventure Graphic cliches and citation, in a personal style. I hope you like it smile
    ah, now i understand. 
    To my knowledge this is not possible or quite difficult to achive. The Actiontext is a combined string from current command + object under cursor and has no direct field in the data structure to edit.
    When you want to overwrite this you need to overwrite the command to a custom name which contains verb+object you clicked. But when moving the mouse it would also put the (maybe under a cursor existing) object, so it could display "use klicked_object current_object".

    A way to "overwrite this" could be some kind of disabling the action text (scriptable if you use the game action text rectangle, not sure about the interface action text rectangle). and output an object text on the same location as the action text until deleting it manually and reset to the normal rectangle...

    Kapitán

    2346 Posts

  • #9, z afrlmeTuesday, 13. June 2017, 21:50 hodinky 7 years ago
    @ Sebastian: I was thinking something along the lines of using an object text as well. It would be easy enough to run a query on mouse over to check current command, if an item is being held & so on to update value which can be used for the display object text. I don't think we can actually force action text to say something different? Pretty sure it's not scriptable.

    Imperátor

    7285 Posts

  • #10, z marco-roncoTuesday, 13. June 2017, 22:04 hodinky 7 years ago
    @ARFLme

    Actually ActionText is scriptable... someway smile

    function Myaction(mousePos)
     return 'my custom phrase here'
    end
    
    registerHookFunction("getActionText", "Myaction")

    We can also get current object name and button name.
    What I miss is to know when the action is concluded (or in progress) smile

    Bažant

    22 Posts

  • #11, z sebastianTuesday, 13. June 2017, 22:37 hodinky 7 years ago
    i guess as long as something is inside this field:

    GameDestinationCommand 

    the user walks to a destination object and will execute the containing command. Maybe you cqn do something with this... 


    Kapitán

    2346 Posts