lotrointerface.com
Search Downloads


Go Back   LoTROInterface > General Discussion > Chit Chat

Reply
Thread Tools Display Modes
  #11  
Unread 05-27-2014, 04:14 AM
Trilesch's Avatar
Trilesch Trilesch is offline
The Undefeated
 
Join Date: Feb 2014
Posts: 8
the plugin is comming along nicely so we have damage done damage taken healing done and healing taken in a nice little box we are now working on the dps side and diffrent attacks side of things.
Reply With Quote
  #12  
Unread 05-29-2014, 11:41 PM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 202
Coroutines do work, sort of. The following code
Code:
local func = coroutine.create(function(num)
    num = coroutine.yield("a" .. tostring(num));
    num = coroutine.yield("b" .. tostring(num));
    num = coroutine.yield("c" .. tostring(num));
    return "d" .. tostring(num);
end);

result, value = coroutine.resume(func, 1); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 2); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 3); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 4); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 5); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
produces the following output:
result = true; value = a1
result = true; value = b2
result = true; value = c3
result = true; value = d4
result = false; value = cannot resume dead coroutine
However, I don't think you can call any API functions within a coroutine (e.g. Turbine.Shell.WriteLine doesn't work), so it seems pretty useless. You can access global variables, though. So if you had a big number crunching task, you could put it in a coroutine that is resumed in an Update() event handler, and spread out the computations over time until complete. I haven't tried this, but it seems like it would work.

Edit: I suppose you could pass a function and arguments to coroutine.yield(), and call the function in Update() when it's returned by coroutine.resume().

Last edited by Thurallor : 05-29-2014 at 11:50 PM.
Reply With Quote
  #13  
Unread 05-31-2014, 08:06 AM
Digpoe Digpoe is offline
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: May 2014
Posts: 7
Quote:
Originally Posted by Equendil
As far as I know, packages, I/O and OS operations, and debug functions have been stripped. I don't think coroutines work either. So basically you have access to the basic (most of it), string, table and math libraries. Well, I've been checking that stuff a long time ago though. Anyway, you might want to check the global scope to see what's in there, I wrote a plugin that lets you do that within LotRO: http://www.lotrointerface.com/downlo...BeDragons.html
Quote:
Originally Posted by Thurallor
Coroutines do work, sort of. The following code
Code:
local func = coroutine.create(function(num)
    num = coroutine.yield("a" .. tostring(num));
    num = coroutine.yield("b" .. tostring(num));
    num = coroutine.yield("c" .. tostring(num));
    return "d" .. tostring(num);
end);

result, value = coroutine.resume(func, 1); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 2); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 3); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 4); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
result, value = coroutine.resume(func, 5); Turbine.Shell.WriteLine("result = " .. tostring(result) .. "; value = " .. tostring(value));
produces the following output:
result = true; value = a1
result = true; value = b2
result = true; value = c3
result = true; value = d4
result = false; value = cannot resume dead coroutine
However, I don't think you can call any API functions within a coroutine (e.g. Turbine.Shell.WriteLine doesn't work), so it seems pretty useless. You can access global variables, though. So if you had a big number crunching task, you could put it in a coroutine that is resumed in an Update() event handler, and spread out the computations over time until complete. I haven't tried this, but it seems like it would work.

Edit: I suppose you could pass a function and arguments to coroutine.yield(), and call the function in Update() when it's returned by coroutine.resume().
Thanks for the info, guys. I did an environment dump (which was weird, because I'm used to a slightly different environment setup where I don't have to use a pairs loop on _G) and I found that a few functions are disabled;
  • loadfile
  • io and os libraries

And a few others which I probably didn't notice. :P

In fact, I'm actually surprised at how little sandboxing of the environment that LoTRO has; I can escape environment sandboxes using the __gc metamethod (I'm used to that being disabled, in fact, I hardly use it at all!) and make custom userdatas using newproxy.
__________________
Some kiddo who knows Lua
Reply With Quote
  #14  
Unread 05-31-2014, 07:50 PM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 202
Just curious, what does making custom userdatas allow you to do?
Reply With Quote
  #15  
Unread 06-01-2014, 08:41 AM
Digpoe Digpoe is offline
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: May 2014
Posts: 7
Quote:
Originally Posted by Thurallor
Just curious, what does making custom userdatas allow you to do?
Well, in layman's terms, it allows you to create an OOP system. In Lua, most types of data are forms of userdatas; that is, file handles and similar. You can check the type of something using the 'type' function; you'll find that tables are used more in LoTRO, which don't allow for very detailed OOP systems.

Here's more on the subject; http://lua-users.org/wiki/HiddenFeatures
__________________
Some kiddo who knows Lua
Reply With Quote
  #16  
Unread 06-03-2014, 11:54 PM
Evendale Evendale is offline
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: Dec 2010
Posts: 7
What bloat was in CA? I think it was pretty efficient tbh (for the amount of data reported)

Last edited by Evendale : 06-03-2014 at 11:56 PM.
Reply With Quote
  #17  
Unread 06-05-2014, 04:55 AM
Digpoe Digpoe is offline
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: May 2014
Posts: 7
Quote:
Originally Posted by Evendale
What bloat was in CA? I think it was pretty efficient tbh (for the amount of data reported)
Well, it wasn't as much bloated, but more just simply all over the place. I had a hard time finding out how some basic features like the Gui worked.
Right now, the new code is split into four scripts as of right now, most of which is just my way of setting up chat parsing and a custom Gui class for creating the interface.
Here's some snippets of code, the things which you can do with it:

Code:
main = Gui.new("Window")
main.Rect = {X=10, Y=10, Width=100, Height=100}
main.BackgroundTransparency = 0.5 -- sets the background transparency (not opacity, it uses the alpha channel)
main.BackgroundColor = Turbine.UI.Color(1, 0, 1) -- sets the colour. Not sure if it retains transparency though.

local a = Gui.new("Label")
a.Name = "TextLabel"
a.Parent = main

main.TextLabel.Text = "Hello World!"

main.Visible = true
__________________
Some kiddo who knows Lua
Reply With Quote
  #18  
Unread 06-06-2014, 12:29 PM
magill's Avatar
magill magill is offline
The Undying
 
Join Date: Sep 2010
Location: Philadelphia PA
Posts: 85
Quote:
Originally Posted by Garan
. Since Narrel indicated that some of the data.lotro functionality may get resurrected at some distant point in the future there may also be hope for a solution to this issue.
"Distant" is probably an understatement. I asked Sapience in one of the recent TTHTI runs if any thing was happening --- his response was nothing in the foreseeable future.
__________________
Bill Magill Mac Player
(OTG)
Val - Man Minstrel (107)
Valalin - Dwarf Minsrel (69)
Valamar - Dwarf Hunter (118)
Valanne - Beorning (105)
Valhad - Elf LM (65)
Valkeeper - Elf RK (85)
Valdicta - Dwarf RK (105)
Valwood - Dwarf RK (80)

Valhunt - Dwarf Hunter (68)
Ninth - Man Warden (65)

"Laid back, not so serious, no drama.
All about the fun!"

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does anyone know what happened to Combat Analysis? magill Chit Chat 56 07-06-2014 09:32 AM
In combat mob list massey91 Interface Requests (D) 1 07-05-2012 11:33 AM
Combat option? worseelite Interface Help (L) 2 11-12-2007 05:48 PM
Scrolling combat text Fisko Interface Requests (L) 1 05-31-2007 01:34 PM
combat indicator ring Yraija Interface Help (L) 0 04-28-2007 03:26 PM


All times are GMT -5. The time now is 09:27 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui