reposition activetext

  • #1, z sebastianSaturday, 29. April 2017, 21:14 hodinky 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

    Kapitán

    2346 Posts


  • #2, z afrlmeSaturday, 29. April 2017, 21:17 hodinky 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?

    Imperátor

    7285 Posts

  • #3, z sebastianSaturday, 29. April 2017, 21:26 hodinky 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")

    Kapitán

    2346 Posts

  • #4, z ke4Sunday, 30. April 2017, 15:04 hodinky 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

    Zabiják klíčů

    810 Posts