Umstieg von VS v4.2.5 zu v5, Lua script Problem ?

  • #1, by malteWednesday, 08. November 2017, 17:43 7 years ago
    Moin,

    wollte die Gunst der Stunde nutzen um mit unserem game auf visionaire 5 umzusteigen.
    Die Verbesserungen überwiegen momentan die Dinge welche aus irgendwelchen Gründen in V5 nicht mehr funktionieren.
    Eines der Probleme würde ich gerne einmal beschreiben und hoffe auf eine Lösung.
    Vermutlich muss das Script nur etwas angepasst werden damit es wieder funktioniert,
    leider bin ich kein Scripter, sondern "nur" ein Grafiker.

    zum Problem: Wir haben hier ein Lua script benutzt um unser Inventar ein oder auszufahren. (Ein script von AFRLme [Lee Clarke]
    In version 4.2.5 funktioniert es wunderbar. In V5 allerdings
    wird das Inventar nur ausgefahren, leider aber danach nicht mehr eingefahren.

    Um das (Definitionscript) aufzurufen nutzen wir auf einem Button
    zum ausfahren des Inventars diese Zeile:
    openInterface("Inventory", 600, easeCircOut)

    und zum wieder einfahren:
    closeInterface("Inventory", 800, easeBounceOut)


    Das (definitions) Script sieht folgendermaßen aus:
    --[[
    Sliding Interface MKII [v3] (27/11/2014)
    Written by AFRLme [Lee Clarke]
    -- + --
    alternatingfrequencies@hotmail.com | skype @ AFRLme
    -- + --
    This script is donation optional. In game credit is non-negotiable.
    You are free to: ¹ use it in your game(s). ² modify the script.
    Do not remove - or edit - this comment block.
    --]]
    
    -- * local variables * --
    local p, ox, oy -- empty variables
    
    -- * local tables * --
    local t = {} -- empty table
    
    t["Blood_Interface"] = {x_in = 115, x_out =  0, y_in = 0, y_out = 0, xo = 0, yo = 0, dir = 2, state = false} -- from right
    t["Inventory"] = {x_in = -635, x_out =  0, y_in = 0, y_out = 0, xo = 0, yo = 0, dir = 2, state = false} -- from right
    
     
    -- * function that slides the interface out * --
    function openInterface(int, delay, easing, dir)
     if t[int]["state"] ~= true then t[int]["state"] = true -- if not already sliding out then begin sliding out (safety measure to make sure it keeps sliding)
      if t[int].dir == 1 or t[int].dir == 2 then p = math.floor(( Interfaces[int].InterfaceOffset.x - t[int].x_out) / (t[int].x_in - t[int].x_out) * 100); delay = math.floor((delay / 100) * p ) end
      if t[int].dir == 3 or t[int].dir == 4 then p = math.floor(( Interfaces[int].InterfaceOffset.y - t[int].y_out) / (t[int].y_in - t[int].y_out) * 100); delay = math.floor((delay / 100) * p ) end
      startObjectTween( Interfaces[int], VInterfaceOffset, Interfaces[int].InterfaceOffset, {x = t[int].x_out, y = t[int].y_out}, delay, easing)
     end
    end
     
    -- * function that slides the interface in * --
    function closeInterface(int, delay, easing, dir)
      t[int]["state"] = false
      if Conditions["mouse_wheel_mode"].ConditionValue then ox = t[int].xo; oy = t[int].yo else ox = 0; oy = 0 end
      if t[int].dir == 1 or t[int].dir == 2 then p = math.floor(( Interfaces[int].InterfaceOffset.x - t[int].x_in) / (t[int].x_out - t[int].x_in) * 100); delay = math.floor((delay / 100) * p ) end
      if t[int].dir == 3 or t[int].dir == 4 then p = math.floor(( Interfaces[int].InterfaceOffset.y - t[int].y_in) / (t[int].y_out - t[int].y_in) * 100); delay = math.floor((delay / 100) * p ) end
      startObjectTween( Interfaces[int], VInterfaceOffset, Interfaces[int].InterfaceOffset, {x = t[int].x_in + ox, y = t[int].y_in + oy}, delay, easing)
    end

    Wie gesagt, dies funktionierte bisweilen sehr gut, aber seit der V5
    bleibt es ausgefahren. Wir sind ein paarmal über das Script gegangen um zu schauen
    ob wir einen Fehler oder dergleichen finden sind aber gescheitert.
    Das ganze hängt natürlich an einer "IF" bedingung damit visionaire weiß ob das menu eingefahren oder ausgefahren ist.

    Könnte mir hier irgend jemand einen Tip geben ? :-(

    Übrigens, die Tablet/Stift unterstützung funktioniert nun in V5 auch nicht mehr richtig,
    so kann man zb keinen linksklick mehr mit einem Stift machen (Wacom tablet)
    Desweiteren will man Char manchmal nicht dort hin gehen wo ich es will, wenn ich zum beispiel auf den weg klicke. Aber das tritt sehr sporadisch auf, mal gehts dann einige sekunden später wieder nicht.

    Liebe Grüße,

    Malte

    Newbie

    32 Posts


  • #2, by afrlmeWednesday, 08. November 2017, 17:53 7 years ago
    That script is somewhat overkill. These days I like to keep it simple. smile
    local int = Interfaces["example"]
    
    if int.InterfaceOffset.x == 0 then -- slide in
     int:to(1000, { InterfaceOffset = {x = -100, y = int.InterfaceOffset.y} }, easeCircOut)
    elseif int.InterfaceOffset.x == -100 then -- slide out
     int:to(1000, { InterfaceOffset = {x = 0, y = int.InterfaceOffset.y} }, easeBounceOut)
    end

    It's somewhat basic, but it works well. It just checks if the interface is in the closed position or open position & if it's one or the other it will slide out or back in, if it's neither then it's already moving so it does nothing.

    I'm sure you can figure out what to do from my example.

    Imperator

    7278 Posts

  • #3, by malteWednesday, 08. November 2017, 18:20 7 years ago
    Hey, that was fast, thanks so much for the "optimized" new script.
    But, i am not sure where to put this part of code ? Is this a definition script, too ?
    Or a "run script" command ?  Sorry, i am a script/Lua noob.

    Anyway, i will try it out.

    Thanks !!!!

    Newbie

    32 Posts

  • #4, by malteWednesday, 08. November 2017, 18:34 7 years ago
    Wow. It works ! Thank you so much !  :-D

    Newbie

    32 Posts

  • #5, by afrlmeWednesday, 08. November 2017, 18:40 7 years ago
    Wow. It works ! Thank you so much !  :-D
    It's an execute a script type. You can add it to a key action or the mouse wheel actions or an interface button, & you're welcome. wink

    Imperator

    7278 Posts