Change Sprite Path

  • #1, by florian-grauertFriday, 28. May, 06:50 3 weeks ago
    Hello Visionaire Community,

    does some of you know how i can change the location of a file of an object?
    specifically that of an Interface Button.
    When I print the Sprite Object of a Button
    with the following expression

    print(button.ActiveSprite.Sprite)

    i get this.

    path Rätsel/Rätsel_0000_Ebene-4.png, width 0, height 0, pos (193,50)

    As you can see this expression already contains the path, however i wasn't able to figure
    out yet how to change it, also i was a bit confused by the documentation since it tells me
    that this object should contain a transparency attribute and some other, that is missing.

    Newbie

    6 Posts


  • #2, by afrlmeFriday, 28. May, 13:09 3 weeks ago
    Change the location? As for the transparency/visibility field, I believe that's tied to the button itself & not the sprite.

    example:
    -- get visibility
    Interfaces["int_example"].Buttons["btn_example"].Visibility

    -- set visibility
    Interfaces["int_example"].Buttons["btn_example"].Visibility = 50

    -- set visibility with tweening (fade between current value to another value over time)
    Interfaces["int_example"].Buttons["btn_example"]:to(1000, {Visibility = 50})
    1
    2
    3
    4
    5
    6
    7
    8

    Imperator

    6979 Posts

  • #3, by florian-grauertFriday, 28. May, 17:13 3 weeks ago
    Change the location? As for the transparency/visibility field, I believe that's tied to the button itself & not the sprite.

    example:
    -- get visibility
    Interfaces["int_example"].Buttons["btn_example"].Visibility

    -- set visibility
    Interfaces["int_example"].Buttons["btn_example"].Visibility = 50

    -- set visibility with tweening (fade between current value to another value over time)
    Interfaces["int_example"].Buttons["btn_example"]:to(1000, {Visibility = 50})
    1
    2
    3
    4
    5
    6
    7
    8

    Well I'm acessing the Button, via

    Button.ActiveSprite.Sprite

    and I want to change the Sprite Object by overwriting it as you showing in the second example with the Visibility.
    But I cant't overwrite it because I can't find the right form in which I have to express
    the Arguments for the Sprite since its a bit more complicater then the Visibility that is simply an integer.
    I printed the Expression above and got this

    path Rätsel/Rätsel_0000_Ebene-4.png, width 0, height 0, pos (193,50)

    but dont know what to do with it.
    I would have to do something like

    Interfaces["int_example"].Buttons["btn_example"].ActiveSprite.Sprite = NewLocation

    Also in the Visionaire docs there is no Visibility attribute for the Button objects
    so why can I change it and how can I know what I can change, for me the
    documentation of all of this is a bit wacky to be honest.

    Newbie

    6 Posts

  • #4, by esmeraldaSaturday, 29. May, 16:49 2 weeks ago
    sadly the documentation is all over the place, there are useful snippets in the wiki and a more up to date list on the luadocs. That's where you can find the Visibilty attribute.

    If I understand correctly, the two states provided by active and inactive image of the button are not enough for your purpose.  You could use animations and force specific animation frames to display.
    ActiveAnimations["name"].AnimationFirstFrame = 1
    ActiveAnimations["name"].AnimationLastFrame = 1

    Great Poster

    425 Posts

  • #5, by florian-grauertMonday, 07. June, 23:36 A week ago
    sadly the documentation is all over the place, there are useful snippets in the wiki and a more up to date list on the luadocs. That's where you can find the Visibilty attribute.

    If I understand correctly, the two states provided by active and inactive image of the button are not enough for your purpose.  You could use animations and force specific animation frames to display.
    ActiveAnimations["name"].AnimationFirstFrame = 1
    ActiveAnimations["name"].AnimationLastFrame = 1

    Thank you that worked very well for my purposes

    Newbie

    6 Posts

Write post