reposition activetext

  • #1, by sebastianSaturday, 29. April 2017, 21:14 8 years ago
    I know there is a hook function for placing automatically e.g. character text fixed on a specific position.

    But is there a possibility to just manually change an active text position from an object or button?

    I tried something like 

    local text = getObject("ActiveTexts[button_name]")


    with the idea to get the textobject for this button as an owner...With no success.

    Is there an easy solution to this or do i have to loop though all active texts and find the right one with the correct owener to solve this?

    kind regards

    Thread Captain

    2346 Posts


  • #2, by afrlmeSaturday, 29. April 2017, 21:17 8 years ago
    I'm not sure that you can position object texts with Lua script? Maybe easier to use the new draw functions instead?

    Imperator

    7285 Posts

  • #3, by sebastianSaturday, 29. April 2017, 21:26 8 years ago
    well activetext is scriptable so yeah it should be working the same as character texts, etc

    EDIT:
    right now i do it like that:

    function txtStart(text)
      if text:getLink(VTextOwner):getId().tableId == eButtons and text:getLink(VTextOwner):getName() == "button_name" then 
        text:setValue(VTextPosition, {x=30,y=40})
      end
    end
    
    registerEventHandler("textStarted", "txtStart")

    Thread Captain

    2346 Posts

  • #4, by ke4Sunday, 30. April 2017, 15:04 8 years ago
    What about the draw function? Or you need it to be within interface to be movable?
    You could connect it with values.

    graphics.addDrawFunc("draw()", 0)
    
    
    function draw()
    
      graphics.drawFont(Values.draw.String, Values.drawX.Int, Values.drawY.Int, 1.0) 
    end

    Key Killer

    810 Posts