Action text too close to cursor / Action-Text zu nahe am Cursor

  • #1, by klootFriday, 11. April 2014, 14:33 10 years ago
    Hello, I'm wondering if there is a super simple solution for this...
    We're having our action text drawn next to the cursor per Visionaire's built in functionality. Our cursor is a bit bigger though, so it almost overlaps the text. Is there a way to offset the position of the text field a few pixels?
    Thanks!

    Deutsch:
    Hallo, wir lassen unseren Action-Text von Visionaires Standardfunktion neben den Cursor setzen. Allerdings ist unsere Cursorgrafik etwas größer, sodass sie den Text beinahe überlappt. Kann man das Textfeld irgendwie verschieben?
    Danke!

    Newbie

    14 Posts


  • #2, by afrlmeFriday, 11. April 2014, 15:51 10 years ago
    hmm maybe with the registerHookFunction & getActionText? I've not actually used it for action texts before so the code block is a guess on my part - off the top of my head.
    local pos
    
    function aText(text)
     pos = text:getPoint(VTextPosition)
     text:setValue(VTextPosition, {x=pos.x + 50, y = pos.y})
     return true
    end
    
    registerHookFunction("getActionText", "aText")
    

    Like I said... I've not tested this at all & I usually only use the hookfunction for manipulating displayed text.

    * edit: doesn't work. sorry. I can't think of anything else off the top of my head at the minute either as I'm half asleep.

    Imperator

    7278 Posts

  • #3, by klootSunday, 13. April 2014, 13:26 10 years ago
    Hi ARFLme, thanks for your reply!
    After reading the wiki a bit, it seems to me that getActionText is actually designed to let you set the action text string for a given mouse position x & y? http://wiki.visionaire-tracker.net/wiki/RegisterHookFunction - seems like a misnomer and should be called setActionText... ?
    Anyway, if I can't access the action text textfield, and I can't use the above function to read out the current action text, is there another way to find out what the current action text is or to draw it somewhere?
    Thanks!

    Newbie

    14 Posts

  • #4, by AlexSunday, 13. April 2014, 13:29 10 years ago
    getActionText returns the displayed action text (must return a string value). It's called getActionText and not setActionText because it is a hook function - the engine calls this function to get the current action text.

    Great Poster

    378 Posts

  • #5, by afrlmeSunday, 13. April 2014, 14:29 10 years ago
    Hi ARFLme, thanks for your reply!
    After reading the wiki a bit, it seems to me that getActionText is actually designed to let you set the action text string for a given mouse position x & y? http://wiki.visionaire-tracker.net/wiki/RegisterHookFunction - seems like a misnomer and should be called setActionText... ?
    Anyway, if I can't access the action text textfield, and I can't use the above function to read out the current action text, is there another way to find out what the current action text is or to draw it somewhere?
    Thanks!


    Aye sorry mate, I was struggling with the generated syntax example/explanation of it - why I have been creating hand written versions of each function once I've tested them & can provide working examples. I've not gotten round to the registerHookFunction yet.

    I didn't see many options in the data structure in regards to action text anyway.

    @ Alex: could you provide a working example of what it would look like please?

    Imperator

    7278 Posts

  • #6, by AlexSunday, 13. April 2014, 14:38 10 years ago
    I've added some examples for the registerHookFunction code, so the next time I upload the generated wiki documentation these examples will be included.

    here is the getActionText example:
    function myActionText(mousePos)
        -- individual action text: object name (in current language) of object below cursor, if there is no object then 'empty' is shown as action text
        local obj = game:getLink(VGameCurrentObject)
        if obj:getId().tableId == eObjects then
          return 'current object: ' .. obj:getTextStr(VObjectName)
        end
        return 'empty'
    end
    registerHookFunction("getActionText", "myActionText")
    

    Great Poster

    378 Posts

  • #7, by afrlmeSunday, 13. April 2014, 15:26 10 years ago
    Cheers Alex smile

    Imperator

    7278 Posts