Questions about Interface/Dialog

  • #1, by LupaShivaSunday, 19. July, 16:17 3 months ago
    Hello everyone

    Checked forum and doesnt seem to find a question to my problem, i have 2 questions if anyone could help:

    -Can´t manage to open the interface in middle of a dialog (to use items in middle of a conversation with an NPC), can that be done?

    -When i place an interface to show from top, it appears sliding but it pushes the scene down, and when the interface appears, the scene returns to normal, any help?

    Thank you all and sorry for my english

    Forum Fan

    122 Posts


  • #2, by NigecSunday, 19. July, 19:23 3 months ago
    Dunno about the first question but the second.... make the interface's "Displacement" Absolute" then set the offset to were you want the interface to show

    Key Killer

    566 Posts

  • #3, by LupaShivaMonday, 20. July, 15:27 3 months ago
    Thanks for the help, but that way the interface doesnt slide, it just appears, or sliding doesnt work with absolute? Thank you

    Forum Fan

    122 Posts

  • #4, by NigecMonday, 20. July, 19:12 3 months ago
    Did you use the sliding inventory from the wiki?
    If its the same one I'm using it and have it absolute

    Key Killer

    566 Posts

  • #5, by LupaShivaTuesday, 21. July, 18:09 3 months ago
    Not working for me =( problably something im doing wrong, tried to download the example, but can't find where to create an account, it only appears log in.

    Forum Fan

    122 Posts

  • #6, by afrlmeTuesday, 21. July, 20:33 3 months ago
    Registration for the wiki is disabled. If you are getting that page/message, then it's because that file no longer exists. We lost a lot of files on the wiki last year - or maybe it was earlier this year (I forget when)  - after the wiki cms was updated.

    Absolute allows you to draw the interface wherever you like without it affecting the scene - basically it draws on top of the scene instead of relative. If you want to slide it out then you need to use code.

    Here's a quick example...

    local int = Interfaces["example"] -- interface you want to slide out
    local df = -100 -- default position on y-axis
    local duration = 250 -- duration time for slide in milliseconds (ms)

    if int.y == 0 then -- slide in
    int:to(duration, { int.Offset = {x = int.x, y = df} }, easeQuintIn)
    elseif int.y == df then -- slide out
    int:to(duration, { int.Offset = {x = int.x, y = 0} }, easeBounceOut)
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9


    You need to edit the 3 local variables as needed. Just add this code inside of execute a script action parts where you want to slide the interface out or back in. You also need to start off with the interface hidden off the screen somewhere, so change the df variable to that position.

    Imperator

    6846 Posts

  • #7, by LupaShivaWednesday, 22. July, 14:45 3 months ago
    Thanks a lot for the help, but not working =(

    i changed to this:

    local int = Interfaces["InventoryOn"] -- InventoryOn its the name of my interface
    local df = -183 -- its the same position on the interface absolute position
    local duration = 500 -- increased the time a little
    if int.y == -183 then -- The inicial position right?
     int:to(duration, { int.Offset = {x = int.x, y = df} }, easeQuintIn)
    elseif int.y == df then -- slide out
     int:to(duration, { int.Offset = {x = int.x, y = 300} }, easeBounceOut) -- y=300 i suppose is where the interface needs to end right?
    end

    Also placed the script on a wheel mouse action executing the script, but its not working, and it is acivated in the char interfaces.

    Forum Fan

    122 Posts

  • #8, by afrlmeWednesday, 22. July, 14:59 3 months ago
    Sorry, I made a typo. Oops. grin

    I shouldn't have added int. in front of Offset.

    local int = Interfaces["InventoryOn"] -- store interface you want to slide inside of a variable
    local dp = -183 -- position of interface when hidden (in)
    local tp = 0 -- position of interface when visible (out)
    local duration = 500 -- the amount of time it takes to slide the interface in/out

    if int.y == tp then -- slide in
    int:to(duration, { Offset = {x = int.x, y = dp} }, easeQuintIn)
    elseif int.y == dp then -- slide out
    int:to(duration, { Offset = {x = int.x, y = tp} }, easeBounceOut)
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

    The position of the interface is based on the top left pixel, so take that into consideration when you slide out. By default I have set 0 because it should slide the interface out so that the top edge of it is on the top edge of the screen viewport. If you want to have it so it doesn't slide out fully then use a negative value (value less than 0). If you want it to slide out further than the top edge of the viewport then use a number higher than 0.

    Quick note: this script will only slide the interface in/out if the interface position is fully slid out or slid in, otherwise it will do nothing. If you want to always slide in/out regardless of position then a bit of math is required as you need to calculate the required duration based on the current position otherwise the sliding speed of the interface will vary, & that's not a good thing.

    Imperator

    6846 Posts

  • #9, by LupaShivaWednesday, 22. July, 16:05 3 months ago
    I dont understand, cant make it work =(

    There was in the wiki a downloadable example right? I cant create an account can someone link that file please? 

    Thanks a lot for the help, i was 3 years away from visionaire and im almost starting from zero.

    Forum Fan

    122 Posts

  • #10, by NigecWednesday, 22. July, 16:32 3 months ago
    the link is broken for the example
    there's one I did here:

    Key Killer

    566 Posts

  • #11, by NigecWednesday, 22. July, 16:36 3 months ago
    the inventory has a button that when entered the inv rises, then there's a on leaving action in the inventory properties that closes it

    Key Killer

    566 Posts

Write post