Custom command property names for same interface action button (use door handle, pickup coin, press button)

  • #30, by AlexFriday, 14. March 2014, 19:27 10 years ago
    I know that getText has been added.

    I added getTextStr (and not getText) just today, so you can't know about that wink

    Plan for vis 4.0 is unchanged (end of month).

    Great Poster

    378 Posts


  • #31, by afrlmeFriday, 14. March 2014, 19:33 10 years ago
    ok sorry - I was thinking of the getText one Simon told me about. Could you send me an example of new getTxtStr via pm or email please?

    Imperator

    7278 Posts

  • #32, by AlexFriday, 14. March 2014, 19:38 10 years ago
    It's already in the wiki (incl. examples). see link above.

    Great Poster

    378 Posts

  • #33, by afrlmeFriday, 14. March 2014, 20:07 10 years ago
    I don't refer to the 2d wiki often... I see both getText & getTextStr aren't in the new wiki... I'll add them later on?

    Imperator

    7278 Posts

  • #34, by AlexFriday, 14. March 2014, 20:28 10 years ago
    actually that was a mistake. I saw you already added it to the new wiki, thanks.

    Great Poster

    378 Posts

  • #35, by afrlmeFriday, 14. March 2014, 20:42 10 years ago
    no problem smile

    here is the compact version of the script of the script mentioned above: http://wiki.visionaire-tracker.net/wiki/Dynamic_Action_Names... - the page also contains a guide.

    I will make a new version of the script based on the new getText/getTextStr functions after I get a new build from David or 4.0 is released.

    Imperator

    7278 Posts

  • #36, by sebastianWednesday, 10. June 2015, 23:59 9 years ago
    I seem to not get this working for me.
    I added the script from http://wiki.visionaire-tracker.net/wiki/Dynamic_Action_Names... as mentioned in the tutorial and made the onmouseenter/leave-stuff but nothing happens when hovering objects.

    The thing i have right now:
    Coin interface like in MI3. The Actiontext shows up in a box at the bottom of the whole screen. When left-click-hold an object on the screen the object gets saved and the coin interface opens. The coin interface has 3 actions (use/look/talk) and by hovering one of the actions the actiontext area shows "use crate" for example.

    Now I want to rename the on screen name from "use" to "push" so that the text at the bottom of the screen says e.g. "push crate".
    I think the script from the wiki works a bit different, because it seems to change the command after it was set. My Interface sets the command when entering the area of the coininterface from the object so after i need it.

    What i need is to rename the "use", "look" or "talk"-button in the inteface before the command is executed and independently from each other (maybe i have to rename two actions at the same time).

    What i have in mind is to execute a script when hovering an object like "rename_use_to(1)" where the value reads a string from a table like use,pickup,etc. The same goes for a talk and look function to rename/reset them independently from each other.


    Thread Captain

    2346 Posts

  • #37, by afrlmeThursday, 11. June 2015, 00:20 9 years ago
    Yep. In 4.x the text system was replaced. So that script is only valid for Visionaire Studio 3.7.1 to 3.0 (probably). I actually wrote some scripts recently for updating the action text, but I'm not sure whether or not I shared them anywhere, as I was mostly writing them for testing purposes to get a grip on how the text / name system works in 4.x as it's more complicated in a way in comparison to the old methods I used in the script you linked.

    This was the function I ended up writing...
    --[[
    Update action text of current language with new text
    Written by AFRLme [Lee Clarke]
    --]]
    
    -- * function which updates the action text of an object for the current language * --
    function setText(obj, txt)
     local texts = obj.TextTextLanguages -- get all texts belonging to the object
     -- + --
     for i = 1, #texts do -- iterate through the stored texts
      if texts[i].language == game.StandardLanguage:getId().id then
       texts[i].text = txt;  obj.TextTextLanguages = texts -- update old text with new text
       break -- no need to keep iterating, cancel the loop
      end
     end
    end
    


    1. add the above script to the script section of your project.

    2. to update the action text you could create an execute a script action containing something like...
    setText(Buttons["use"], "new text")
    

    ... which would update the text of button "use" to "new text".

    Obviously you are going to have to use some if queries either with Lua script or in the editor if you plan on using the value & mouse enter method for updating the text.

    I think, this should be enough information to get you on the right track? Anyway, good luck. wink

    Imperator

    7278 Posts

  • #38, by sebastianThursday, 11. June 2015, 01:19 9 years ago
    i'll try it out tomorrow smile

    Thread Captain

    2346 Posts

  • #39, by afrlmeThursday, 11. June 2015, 12:41 9 years ago
    The script isn't exactly designed what you were asking for, as it's not what I wrote it for, but you could easily modify it based on the old script you linked.

    & no problem, let me know if you get it working.

    Imperator

    7278 Posts

  • #40, by sebastianThursday, 11. June 2015, 12:54 9 years ago
    so i have to implement the new script in the old one? I may have to try&error this out. I never did Lua but the functions are quite easy to understand whats going on. I'll give Feedback this afternoon when im home from work

    Thread Captain

    2346 Posts