|
05-27-2014, 04:14 AM
|
|
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.
|
05-29-2014, 11:41 PM
|
|
The Undying
|
|
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.
|
05-31-2014, 08:06 AM
|
The Undefeated
|
|
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
|
05-31-2014, 07:50 PM
|
|
The Undying
|
|
Join Date: May 2013
Posts: 202
|
|
Just curious, what does making custom userdatas allow you to do?
|
06-01-2014, 08:41 AM
|
The Undefeated
|
|
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
|
06-03-2014, 11:54 PM
|
The Undefeated
|
|
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.
|
06-05-2014, 04:55 AM
|
The Undefeated
|
|
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
|
06-06-2014, 12:29 PM
|
|
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!"
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:25 AM.
|
|