We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 12 of 12
  1. #1
    Join Date
    Sep 2010
    Posts
    1,491

    Problem trying to get info saved in plugindata files.

    Hello, i'm trying to get info from a file using:

    NotaCargadaVariable = Turbine.PluginData.Load( Turbine.DataScope.Character, "whatever" );
    self.textInput:SetText(NotaCar gadaVariable);


    That's on my main window and is working perfect. But now i just copied that same structure to a second window (wich uses a second .lua file) and it doesn't get the info (the point would be to fill the new window with the Same info as the previous one, for testing since the example below this won't work neither), actually the plugin is unable to load due to an error.

    So i though maybe was because the names was the same ones and i changed a bit to:

    NotaCargadaVariable2 = Turbine.PluginData.Load( Turbine.DataScope.Character, "whatever2" );
    self.textInput:SetText(NotaCar gadaVariable2);


    But still doesn't work properly.

    I want to say i know "nothing" about LUA and i'm starting learning by trying codes from other plugins and building a new one just for fun and becuase i personally think the plugins community still lacks of it (i won't tell you what it's about but you will enjoy for sure )

    So... can anyone tell me what is wrong? Why the first window loads the file and fill the textinput with the information in Whatever file BUT the second window doesn't? I tried for 2 days with no luck getting info for a second window. Didn't worked to get position of the window and didn't work to get this code in orange.

    Updated, the error message is: ...gins\SaelythPlugins\myplugin \myWindow.lua:20: The data load event handler must be specified and a valid function.
    Last edited by Saelyth; May 07 2012 at 10:50 AM.

  2. #2
    Join Date
    Mar 2007
    Posts
    1,211

    Re: Problem trying to get info saved in plugindata files.

    Turbine limits real-time access to data to prevent data exchange with external applications. You can only save/load data in real-time when a plugin is initializing or being unloaded. At any other time, the call must include a callback function as an additional parameter - the callback will be passed the data in the case of a load call.

  3. #3
    Join Date
    Sep 2010
    Posts
    1,491

    Re: Problem trying to get info saved in plugindata files.

    I got a window that loads a few settings from a file and i want to open a new window that loads info from a different file...
    So could be possible to make the info is loaded when first window is loaded and then use that info when the second window is open?

    And thanks Garan, i recall your name and i'm a fan of the Rainbow Plugin ^^.

    Edit: Just that worked perfect, the main window loads the info of the secondary window also and when second window is opened the main window uses it
    Problem now: If i Save new info and then i close and re-open the window, it loads the Old info and not the new one just saved, any thoughs about this?.

    Edit 2: I read your post several times and i don't get how to make a callback. (since english is not my native languaje i find hard to understand a few things) What i need to do is fill a textInput With the String of a file named Whatever2

    Edit 3: I just found this....
    Quote Originally Posted by Garan View Post
    At the very least, most plugins will want to store user preferences. In an attempt to reduce potential botting and real-time communication with external applications, Turbine limited file access to .plugindata files and implemented a delay on real-time data saving and loading. While this mechanism can be frustrating at times, it can be made to work for the vast majority of applications.

    There are three very important states that a plugin goes through in its life cycle. I refer to these as the loading state, the running state and the unloading state. The loading state is the period between when the "/plugins load " command is issued and when the main Lua file is completely loaded. Once the main Lua file is loaded and until the plugin's apartment is Unloaded the plugin is in its running state. If the user executes a "/plugins unload ApartmentName" command (where ApartmentName is blank or matches the specific plugin's apartment) or another plugin unloads the plugin's apartment programatically the plugin enters the unloading state which will end when the plugin is terminated.

    The PluginData.Load() method normally requires three parameters, dataScope, key, and dataLoadEventHandler where dataLoadEventHandler is a callback function that is called once the delay time has passed. However, when a plugin is in the loading or unloading state, the dataLoadEventHandler is not passed since the Plugin.Load() method will return the results immediately. The same is true for the PluginData.Save() method. Many plugins require real-time data access to their own saved data in order to function efficiently - for instance MoorMap has tens of thousands of data entries which would cause a major lag spike whenever the user changed maps if they were all retained in memory at once. To bypass the restriction, it is necessary to use a second plugin to manage loading and unloading the plugin as necessary, allowing it to enter the loading and unloading states as needed to access its saved data.

    If you ever get the error message "The data load event handler must be specified and a valid function" it means that you called the PluginData.Load() method during the running state (after the plugin completed loading) without the dataLoadEventHandler parameter.
    But i don't know what are the DataLoadEventHandler or if i can run a PluginData.Load() method during the running state if i add a DataLoadEventHandler
    Last edited by Saelyth; May 07 2012 at 11:42 PM.

  4. #4
    Join Date
    Mar 2007
    Posts
    1,211

    Re: Problem trying to get info saved in plugindata files.

    Quote Originally Posted by Saelyth View Post
    But i don't know what are the DataLoadEventHandler or if i can run a PluginData.Load() method during the running state if i add a DataLoadEventHandler
    The dataLoadEventHandler is just a Lua function that you create which is called with the data when it becomes available. For instance:

    Code:
    loadHandler=function(loadedData)
      if loadedData~=nil then
    -- perform some processing on the data
      end
    end
    
    local result=Turbine.PluginData.Load(Turbine.DataScope.Character, "SomeSetting", loadHandler)
    in this example, the dataLoadEventHandler is the function "loadHandler". When the PluginData.Load command is executed in the running state it doesn't immediately return the data, instead after a 30 second delay, the dataLoadEventHandler is called and is passed the data as a table. So loadHandler would be called (which is why it is termed a "callback" function) by the client with the actual data that is loaded.

    In answer to your question, yes, you can run PluginData.Load() in the running state as long as you provide a callback function that can recieve the data. However, you will still have to accept the 30 second delay that Turbine imposes if you load the data while in the running state.

  5. #5
    Join Date
    Mar 2007
    Posts
    1,211

    Re: Problem trying to get info saved in plugindata files.

    Plugins can not unload themselves, they need another plugin to perform that action for them but it doesn't seem as though your needs are complex enough to require that. You should be able to load all the data in your main window and save it when your plugin unloads. Any window can access the data of the main window (there is no data encapsulation, Lua is not an OO language).

    Also, in your sample code you asign a function to Turbine.Plugin.Unload which can cause serious problems for any other plugin using the same apartment. You should be assigning to plugin.Unload (note the variable that references your own plugin instance has no capital) if you are assigning it during initialization or Turbine.Plugins["yourname"].Unload if you are assigning the unload handler after the plugin has already loaded (such as in an Update handler).

    You are getting the error when trying to reload because your plugin has not been unloaded. As mentioned above, you would need another plugin to unload your plugin (see how MoorMap works) or have a user use the "/plugins unload yourpluginname" command.

  6. #6
    Join Date
    Sep 2010
    Posts
    1,491

    Re: Problem trying to get info saved in plugindata files.

    So let me understand what i could do to save that problem.

    1: I got A LOT of info into .plugindata files, i Load all them while plugin is loading.
    2: I store them into temporal aliases, still loading phase.
    3: Now we'r in the running phase. I can load info from the aliases anytime, i can save to the aliases anytime.
    4: When i'm done, the plugin will save all the info from the aliases into the .plugindata files using the real-time call when it's Unloading.

    ... What do you think?

    Edit: Trying this i found a problem... ¿How do a plugin unloads itself?
    Code:
    function Descargando:Constructor()
        Turbine.UI.Lotro.Window.Constructor( self );
        
        self:SetBackColor( Turbine.UI.Color() );
        self:SetSize(250, 150);
        self:SetText("Unloader");
        self:SetOpacity(0.8);
        self:SetPosition( 250, 250 );
    
        Turbine.Plugin.Unload()
        
    
    end
    
        Turbine.Plugin.Unload = function (sender, args)
        Turbine.Shell.WriteLine("Test to see if plugin gets this far");
    end
    That it works but when i try to Load the plugin again i got an error message: Unable to load "myplugin".

    So... how do i make a plugin is unloaded to be easily loaded typing the "/plugins load myplugin" command?
    Last edited by Saelyth; May 08 2012 at 04:53 PM.

  7. #7
    Join Date
    Sep 2010
    Posts
    1,491

    Re: Problem trying to get info saved in plugindata files.

    well, i got over that problems and my plugin is so far starting to look really good. But there's still 2 things i'm not able to do. The first one is to get a Timer to control how long i've been in combat.

    I downloaded 4 different plugins for timers, tested them, check how they create the timer... no clue about how it works, really, i feel like a noob lvl -1.

    The expected function is:
    1: Open window, check if i'm in combat or not all the time.
    2: If i'm in combat, start a timer and keep updating the time into the titlelabel
    3: If timer goes to 100, stop and trigger another function.

    Code:
    function mywindow:Constructor()
        Turbine.UI.Lotro.Window.Constructor( self );
        
        --window propertys
        self:SetBackColor( Turbine.UI.Color() );
        self:SetSize(300, 300);
        self:SetText("mywindow");
        self:SetOpacity(0.8);
        self:SetPosition( windowSettings.positionX, windowSettings.positionY );
    
            --Text of first timer
        self.titleLabel = Turbine.UI.Label();
        self.titleLabel:SetParent( self );
        self.titleLabel:SetPosition(40 , 55);
        self.titleLabel:SetFont(Turbine.UI.Lotro.Font.Verdana18);
        self.titleLabel:SetForeColor( Turbine.UI.Color( 10, 10, 255 ) );
        self.titleLabel:SetText("Timer 1:");    
        self.titleLabel:SetSize(175, 20);
    
            --the timer value
        self.titleLabel2 = Turbine.UI.Label();
        self.titleLabel2:SetParent( self );
        self.titleLabel2:SetPosition(185 , 55);
        self.titleLabel2:SetFont(Turbine.UI.Lotro.Font.Verdana18);
        self.titleLabel2:SetForeColor( Turbine.UI.Color( 0, 1, 0 ) );
        self.titleLabel2:SetText("0.0");    
        self.titleLabel2:SetSize(50, 20);
    end
    The timer would track when i enter a combat, keep updating the titlelabel2 Text until it goes to 100, then stop and trigger a new function that i would create with no problems.

    Anyone can throw me a bone?

  8. #8
    Join Date
    Mar 2007
    Posts
    1,211

    Re: Problem trying to get info saved in plugindata files.

    Quote Originally Posted by Saelyth View Post
    The expected function is:
    1: Open window, check if i'm in combat or not all the time.
    2: If i'm in combat, start a timer and keep updating the time into the titlelabel
    3: If timer goes to 100, stop and trigger another function.
    Timers in LoTRO Lua are usually implemented with an Update event handler which fires once every time a frame is rendered. The first question is what are your units of time - you say if the "timer goes to 100" - 100 what? I'm going to assume seconds for my example. Also, why are you checking "if i'm in combat or not all the time" as opposed to using the InCombatChanged() event? Is there a bug in the event? I don't usually use that particular event so I honestly don't know, but it would save some excess processing on the client if it is functional.

    Here's a sample of a window that does basically what you are after - note the InCombatChanged() event handler that simply enables the Update event handler upon entering combat. Update event handlers should only be enabled when they are really used, in this case for the first 100 seconds.
    Code:
    localPlayer=Turbine.Gameplay.LocalPlayer:GetInstance();
    TimerWindow=Turbine.UI.Window();
    TimerWindow:SetSize(100,20); -- make it bigger if you have other stuff to show...
    TimerWindow:SetPosition(300,10); -- just a somewhat out of the way spot near the top of the screen
    TimerWindow:SetBackColor(Turbine.UI.Color(.2,0,0))
    TimerWindow.Timer=Turbine.UI.Label();
    TimerWindow.Timer:SetParent(TimerWindow);
    TimerWindow.Timer:SetSize(100,20);
    TimerWindow.Timer:SetPosition(0,0);
    TimerWindow.Timer.StartTime=0;
    TimerWindow.Timer.EndTime=0;
    TimerWindow.Timer.OnTimeout=function() end -- placeholder for whatever to do when time runs out
    TimerWindow.Timer.OnCancel=function() end -- placeholder for whatever to do if the combat state ends before the timer
    TimerWindow.Timer.Update=function()
     local currentTime=Turbine.Engine.GetGameTime();
     if currentTime>=TimerWindow.Timer.EndTime then
      -- disable timer and call OnTimeout
      TimerWindow.Timer:SetWantsUpdates(false);
      TimerWindow:SetVisible(false);
      TimerWindow.Timer:OnTimeout();
     -- for your case, you should also test the IsInCombat() flag just in case the combat lasted less time than the 100 seconds but you can also just handle that in the OnTimeout function
     elseif not localPlayer:IsInCombat() then
      TimerWindow.Timer:SetWantsUpdates(false);
      TimerWindow:SetVisible(false);
      TimerWindow.Timer:OnCancel();
     else
      TimerWindow.Timer:SetText(math.floor(currentTime-TimerWindow.Timer.StartTime));
     end
    end
    CombatTimer=function()
     if localPlayer:IsInCombat() then
      TimerWindow.Timer.StartTime=Turbine.Engine.GetGameTime();
      TimerWindow.Timer.EndTime=TimerWindow.Timer.StartTime+100;
      TimerWindow:SetVisible(true);
      TimerWindow.Timer:SetWantsUpdates(true); -- enable the update timer
    Turbine.Shell.WriteLine("Entered Combat")
     end
    end
    CombatChangedHandler=AddCallback(localPlayer,"InCombatChanged",CombatTimer)
    -- set up the real OnCancel and OnTimeout handlers
    TimerWindow.Timer.OnCancel=function()
     Turbine.Shell.WriteLine("Left Combat");
    end
    TimerWindow.Timer.OnTimeout=function()
     Turbine.Shell.WriteLine("Timer Expired");
    end
    of course, you would want to use RemoveCallback() for the "InCombatChanged" event handler in your unload event and you would want the functions to do something real, but the timer concept should be pretty clear - use the :GetGameTime() method to get the number of seconds, both to generate the end time and to test the current time against the end time. Use an Update handler to fire the comparison, just remember to only enable it when the timer is running and disable it all other times (limits the impact on the client).

  9. #9
    Join Date
    Sep 2010
    Posts
    1,491

    Re: Problem trying to get info saved in plugindata files.

    Testing it with the improvements done to adapt it to my example. Wich is so far a Draigoch tanking window. So... i'm gonna paste here the whole window. all you need to do for testing is add TankeandoDraigoch as a class window and import the file.

    Code:
       -- Funcion de Abrir el Tank management
    function TankeandoDraigoch:Constructor()
        Turbine.UI.Lotro.Window.Constructor( self );
    
        -- Propiedades de Ventana
        self:SetBackColor( Turbine.UI.Color() );
        self:SetSize(250, 200);
        self:SetText("Tanking");
        self:SetOpacity(1.0);
        self:SetPosition( windowSettings.positionX, windowSettings.positionY );
    
             --Texto de arriba
        self.titleLabel = Turbine.UI.Label();
        self.titleLabel:SetParent( self );
        self.titleLabel:SetPosition(40 , 37);
        self.titleLabel:SetFont(Turbine.UI.Lotro.Font.Verdana14);
        self.titleLabel:SetText("When red label appears, click in what Draigoch does.");    
        self.titleLabel:SetSize(200, 40);
    
            --Texto del primer timer
        self.titleLabel = Turbine.UI.Label();
        self.titleLabel:SetParent( self );
        self.titleLabel:SetPosition(40 , 150);
        self.titleLabel:SetFont(Turbine.UI.Lotro.Font.Verdana14);
        self.titleLabel:SetText("Timer for Phase 1: ");    
        self.titleLabel:SetSize(200, 20);
    
        self.titleLabelpreparate = Turbine.UI.Label();
        self.titleLabelpreparate:SetParent( self );
        self.titleLabelpreparate:SetPosition(50 , 98);
        self.titleLabelpreparate:SetBackColor(Turbine.UI.Color( 0.6, 1, 0, 0));
        self.titleLabelpreparate:SetFont(Turbine.UI.Lotro.Font.TrajanProBold22);
        self.titleLabelpreparate:SetTextAlignment( Turbine.UI.ContentAlignment.MiddleCenter );
        self.titleLabelpreparate:SetForeColor( Turbine.UI.Color( 0, 1, 0 ) );
        self.titleLabelpreparate:SetText("HE'S MOVING!");    
        self.titleLabelpreparate:SetSize(170, 20);
        self.titleLabelpreparate:SetVisible( false );
    Your timer a little bit addapted
    Code:
            --primer timer
        localPlayer=Turbine.Gameplay.LocalPlayer:GetInstance();
        TankeandoDraigoch.Timer=Turbine.UI.Label();
        TankeandoDraigoch.Timer:SetParent(TankeandoDraigoch);
        TankeandoDraigoch.Timer:SetSize(100,20);
        TankeandoDraigoch.Timer:SetForeColor( Turbine.UI.Color( 0, 1, 0 ) );
        TankeandoDraigoch.Timer:SetFont(Turbine.UI.Lotro.Font.Verdana18);
        TankeandoDraigoch.Timer:SetPosition(170,148);
        TankeandoDraigoch.Timer.StartTime=0;
        TankeandoDraigoch.Timer.EndTime=0;
        TankeandoDraigoch.Timer.OnTimeout=function() end -- placeholder for whatever to do when time runs out
        TankeandoDraigoch.Timer.OnCancel=function() end
        
        -- Lo que pasa cuando el combate acaba antes que el timer. Desactiva el contador y luego esto sucede.
        TankeandoDraigoch.Timer.OnCancel=function()
        Turbine.Shell.WriteLine("<rgb=#ff0000>Saelyth's plugin ID bug 25</rgb>");
        Turbine.Shell.WriteLine("<rgb=#ff0000>Saelyth's plugin ID bug 13 + 25</rgb>");
        end
    
        -- Lo que pasa cuando llega al tiempo especificado. Desactiva el contador y luego esto sucede.
        TankeandoDraigoch.Timer.OnTimeout=function()
         self.titleLabelpreparate:SetVisible( true );
          TankeandoDraigoch.Timer:SetText("Waiting...");
        end
    
    
        TankeandoDraigoch.Timer.Update=function()
         local currentTime=Turbine.Engine.GetGameTime();
         if currentTime>=TankeandoDraigoch.Timer.EndTime then
          -- disable timer and call OnTimeout
          TankeandoDraigoch.Timer:OnTimeout();
         elseif not localPlayer:IsInCombat() then
          TankeandoDraigoch.Timer:SetWantsUpdates(false);
          TankeandoDraigoch.Timer:OnCancel();
         else
          TankeandoDraigoch.Timer:SetText(math.floor(currentTime-TankeandoDraigoch.Timer.StartTime));
         end
        end
    
        CombatTimer=function()
         if localPlayer:IsInCombat() then
          TankeandoDraigoch.Timer.StartTime=Turbine.Engine.GetGameTime();
          TankeandoDraigoch.Timer.EndTime=TankeandoDraigoch.Timer.StartTime+5; --deberia ser 75 para phase 1
          TankeandoDraigoch.Timer:SetWantsUpdates(true); -- enable the update timer
        Turbine.Shell.WriteLine("timer starts x2 messages")
         end
        end
        CombatChangedHandler=AddCallback(localPlayer,"InCombatChanged",CombatTimer)
    And it continues.
    Code:
            --Texto del segundo timer
        self.titleLabel3 = Turbine.UI.Label();
        self.titleLabel3:SetParent( self );
        self.titleLabel3:SetPosition(40 , 170);
        self.titleLabel3:SetFont(Turbine.UI.Lotro.Font.Verdana14);
        self.titleLabel3:SetText("Timer for Phase 2:");    
        self.titleLabel3:SetSize(200, 20);
    
                 -- Boton de salto derecha    
        self.saltoderecha = Turbine.UI.Label();
        self.saltoderecha:SetParent( self );
        self.saltoderecha:SetPosition(130, 70);
        self.saltoderecha:SetFontStyle(Turbine.UI.FontStyle.Outline);
        self.saltoderecha:SetFont(Turbine.UI.Lotro.Font.Verdana16);
        self.saltoderecha:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
        self.saltoderecha:SetText("Jumping Right");
        self.saltoderecha:SetSize(100, 25);
        self.saltoderecha:SetZOrder(110);
        self.saltoderecha:SetBackColor(Turbine.UI.Color( 0.4, 0, 0, 1));
        self.saltoderecha:SetBackColorBlendMode(Turbine.UI.BlendMode.Normal);
        self.saltoderecha:SetMouseVisible(false);
        -- Crea un quickslot en el mismo lugar que el boton.
        quickslotsaltoderecha = Turbine.UI.Lotro.Quickslot();
        quickslotsaltoderecha:SetParent(TankeandoDraigoch);
        quickslotsaltoderecha:SetSize(100,25);
        quickslotsaltoderecha:SetPosition(130, 70);
        quickslotsaltoderecha:SetZOrder(100);
        quickslotsaltoderecha:SetUseOnRightClick(false);
        Mensajeaenviarsaltoderecha = "/ra <rgb=#ff0000>-- LEFT --</rgb>";
        quickslotsaltoderecha:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Alias, Mensajeaenviarsaltoderecha));
        quickslotsaltoderecha:SetAllowDrop(false);
        quickslotsaltoderecha:SetVisible(true);
    
                 -- Boton de salto izquierdo
        self.saltoizquierda = Turbine.UI.Label();
        self.saltoizquierda:SetParent( self );
        self.saltoizquierda:SetPosition(20, 70);
        self.saltoizquierda:SetFontStyle(Turbine.UI.FontStyle.Outline);
        self.saltoizquierda:SetFont(Turbine.UI.Lotro.Font.Verdana16);
        self.saltoizquierda:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
        self.saltoizquierda:SetText("Jumping Left");
        self.saltoizquierda:SetSize(100, 25);
        self.saltoizquierda:SetZOrder(110);
        self.saltoizquierda:SetBackColor(Turbine.UI.Color( 0.4, 0, 0, 1));
        self.saltoizquierda:SetBackColorBlendMode(Turbine.UI.BlendMode.Normal);
        self.saltoizquierda:SetMouseVisible(false);
        -- Crea un quickslot en el mismo lugar que el boton.
        quickslotsaltoizquierda = Turbine.UI.Lotro.Quickslot();
        quickslotsaltoizquierda:SetParent(TankeandoDraigoch);
        quickslotsaltoizquierda:SetSize(100,25);
        quickslotsaltoizquierda:SetPosition(20, 70);
        quickslotsaltoizquierda:SetZOrder(100);
        quickslotsaltoizquierda:SetUseOnRightClick(false);
        Mensajeaenviarsaltoizquierda = "/ra <rgb=#ff0000>-- RIGHT --</rgb>";
        quickslotsaltoizquierda:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Alias, Mensajeaenviarsaltoizquierda));
        quickslotsaltoizquierda:SetAllowDrop(false);
        quickslotsaltoizquierda:SetVisible(true);
    
                -- Boton de pata derecha
        self.pataderecha = Turbine.UI.Label();
        self.pataderecha:SetParent( self );
        self.pataderecha:SetPosition(130, 120);
        self.pataderecha:SetFontStyle(Turbine.UI.FontStyle.Outline);
        self.pataderecha:SetFont(Turbine.UI.Lotro.Font.Verdana16);
        self.pataderecha:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
        self.pataderecha:SetText("Claw on Right");
        self.pataderecha:SetSize(100, 25);
        self.pataderecha:SetZOrder(110);
        self.pataderecha:SetBackColor(Turbine.UI.Color( 0.4, 0, 0, 1));
        self.pataderecha:SetBackColorBlendMode(Turbine.UI.BlendMode.Normal);
        self.pataderecha:SetMouseVisible(false);
        -- Crea un quickslot en el mismo lugar que el boton.
        quickslotpataderecha = Turbine.UI.Lotro.Quickslot();
        quickslotpataderecha:SetParent(TankeandoDraigoch);
        quickslotpataderecha:SetSize(100,25);
        quickslotpataderecha:SetPosition(130, 120);
        quickslotpataderecha:SetZOrder(100);
        quickslotpataderecha:SetUseOnRightClick(false);
        Mensajeaenviarpataderecha = "/ra <rgb=#ff0000>-- RIGHT --</rgb>";
        quickslotpataderecha:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Alias, Mensajeaenviarpataderecha));
        quickslotpataderecha:SetAllowDrop(false);    
        quickslotpataderecha:SetVisible(true);
    
                 -- Boton de pata izquierda
        self.pataizquierda = Turbine.UI.Label();
        self.pataizquierda:SetParent( self );
        self.pataizquierda:SetPosition(20, 120);
        self.pataizquierda:SetFontStyle(Turbine.UI.FontStyle.Outline);
        self.pataizquierda:SetFont(Turbine.UI.Lotro.Font.Verdana16);
        self.pataizquierda:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
        self.pataizquierda:SetText("Claw on Left");
        self.pataizquierda:SetSize(100, 25);
        self.pataizquierda:SetZOrder(110);
        self.pataizquierda:SetBackColor(Turbine.UI.Color( 0.4, 0, 0, 1));
        self.pataizquierda:SetBackColorBlendMode(Turbine.UI.BlendMode.Normal);
        self.pataizquierda:SetMouseVisible(false);
        -- Crea un quickslot en el mismo lugar que el boton.
        quickslotpataizquierda = Turbine.UI.Lotro.Quickslot();
        quickslotpataizquierda:SetParent(TankeandoDraigoch);
        quickslotpataizquierda:SetSize(100,25);
        quickslotpataizquierda:SetPosition(20, 120);
        quickslotpataizquierda:SetZOrder(100);
        quickslotpataizquierda:SetUseOnRightClick(false);
        Mensajeaenviarpataizquierda = "/ra <rgb=#ff0000>-- LEFT --</rgb>";
        quickslotpataizquierda:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Alias, Mensajeaenviarpataizquierda));
        quickslotpataizquierda:SetAllowDrop(false);
        quickslotpataizquierda:SetVisible(true);
    end
    But no matter what, it doesn't track the "Out of combat events". I tried to spam the "ID bug 25" text but it never triggers even if i'm not in combat. By the way the "timer starts x2 messages" repeat itself, so i got 2 messages, no idea why.

    Sorry for being such a pain, Garan. My programming knowledge is Null and i'm trying to learn but i got stuck sometimes.
    The expected code that i'm trying to create is:
    1: If i'm in combat, start the timer.
    2: If timer gets to 75, Make the self.titleLabelpreparate:SetVi sible( true ); but don't stop timer.
    3: If timer gets to 80, Make the self.titleLabelpreparate:SetTe xt("Body is down..."); Stop timer.
    4: If suddenly i'm out of combat, stop the timer and self.titleLabelpreparate:SetVi sible( false );


    And being able to repeat that rotation each time i enter/ends a combat. I'm trying different ways but i'm getting stuck in the OnCancel event.

    Sidenote: Garan, if you don't mind, could we speak through a messaging program? it's way faster than using the forums and i'm sure this won't be my last problem. No worries if you don't want to be bothered, i understands.

    Sidenote 2: I'm trying to find a way to Read from chat so when Draigoch says "Whatever i say to start phase 2" My plugin would disable the timer1 and start using the timer2. But i won't be bother with that problems yet until i can figure out how timer really works.
    Last edited by Saelyth; May 12 2012 at 12:52 PM.

  10. #10

    Re: Problem trying to get info saved in plugindata files.

    Two immediate problems I've noticed.

    1) You're only giving yourself 5 seconds for the timer, not 75 seconds - if you don't end combat soon enough, you can't get to the OnCancel() call, since the first thing it'll do is check if you've finished passed the EndTime.

    2) You should probably use self and not TankeandoDraigoch. TankeandoDraigoch is the class name, while self is the particular instance of the class. (Not sure how much programming experience you have, so... I'll try to explain.) Basically, TankeandoDraigoch can be viewed as a set of instructions that says here is how you create a TankeandoDraigoch window. self is a particular instance - an actual TankeandoDraigoch window. For the most part, using TankeandoDraigoch and not self won't be a problem, but I've no idea what the :SetParent(TankeandoDraigoch) will do - you've basically said, attach this label to the instructions on how to build a TankeandoDraigoch window, instead of the actual window that will pop up.

    Also, if you want a variable length time, I'd just save the start time of when you enter into combat, and then calculate the elapsed time on each update.

  11. #11
    Join Date
    Sep 2010
    Posts
    1,491

    Re: Problem trying to get info saved in plugindata files.

    Quote Originally Posted by moebius92 View Post
    Two immediate problems I've noticed.

    1) You're only giving yourself 5 seconds for the timer, not 75 seconds - if you don't end combat soon enough, you can't get to the OnCancel() call, since the first thing it'll do is check if you've finished passed the EndTime.

    2) You should probably use self and not TankeandoDraigoch. TankeandoDraigoch is the class name, while self is the particular instance of the class. (Not sure how much programming experience you have, so... I'll try to explain.) Basically, TankeandoDraigoch can be viewed as a set of instructions that says here is how you create a TankeandoDraigoch window. self is a particular instance - an actual TankeandoDraigoch window. For the most part, using TankeandoDraigoch and not self won't be a problem, but I've no idea what the :SetParent(TankeandoDraigoch) will do - you've basically said, attach this label to the instructions on how to build a TankeandoDraigoch window, instead of the actual window that will pop up.

    Also, if you want a variable length time, I'd just save the start time of when you enter into combat, and then calculate the elapsed time on each update.
    1: yeah, i was trying the plugin against Training-Dummys, so... 5 seconds.
    2: i noticed this as well, and i'm using self and the window name ramdomly tbh, since i miss where i should or shouldn't usually use them. Thanks for the explanation.
    I don't know how to calculate using programming. So far all the maths involved functions i can't do them. That is why i came here looking for help.

    Updating from my previous post: i got the Received from chat option enabled, it's working But when it does it set visible a new label perfectly but it doesn't "setvisible ( false )" another different Label, anything that i'm missing about?. The trick is suppose to be for Making a label visible instead of a the one that is there right now. Doing this because if i use the SetText event, the 2 texts appear at same time, Old one and New one, and then the text can't be read properly.

    Sorry about my poor explanation, my english is not that good.

  12. #12
    Join Date
    Mar 2007
    Posts
    1,211

    Re: Problem trying to get info saved in plugindata files.

    Quote Originally Posted by Saelyth View Post
    Sidenote: Garan, if you don't mind, could we speak through a messaging program? it's way faster than using the forums and i'm sure this won't be my last problem. No worries if you don't want to be bothered, i understands.

    Sidenote 2: I'm trying to find a way to Read from chat so when Draigoch says "Whatever i say to start phase 2" My plugin would disable the timer1 and start using the timer2. But i won't be bother with that problems yet until i can figure out how timer really works.
    I'll send you a PM when I get a chance so we can discuss chatting outside the forums. Right now I'm a bit tied up between real life projects and the Update 7 changes - I haven't even logged in to actually play the game since U7 went live on Bullroarer.

    Meanwhile, LoTRO Alerts is a pretty good example of how to access the Chat object as well as having an example of using a timer (actually several timers, one for Cooldown, one for Duration, one for Flashing and one for Delay). You might want to try digging through that for some insight into how Chat and Timers work.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload