ScriptUO
Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: manwinc on September 19, 2010, 08:06:24 PM
-
The Biggest thing that would make me switch between EUO and OEUO is the difference in the latency in its ability to locate items.
I have some experience in the coding for OEUO, But am not using it on a regular basis, so was wondering if someone could do a test for me.
Compare the time required in ms for finding and getting the property of all items within your backpack, report the time required to complete the code, and the number of items in your backpack.
I would be greatly appreciative.
-
It's pretty easy with my finditem subs I wrote for OEUO. It's all built-in..... You might try and give it a shot. Look at this thread:
http://www.scriptuo.com/index.php?topic=5960.0
property is automatically collected for each item found.
I'm in the middle of doing some coding for the file subs, but what you ask is pretty easy to do with those subs.
-
And just for the lazy, here's the test:
(btw, as I figured, there isn't much speed difference)
EUO code:
set #LPC 10000
set %time #SCNT2
finditem * C_ , #BACKPACKID
for #FINDINDEX 1 #FINDCNT
event property #FINDID
set %time #SCNT2 - %time
display ok %time
stop
Time = 1.8 seconds for 33 items (#LPC has no effect)
OEUO code:
dofile("tm_subs_collection6.lua")
time = getticks()
count, stack, items = TM_FindItem("*","c", {UO.BackpackID}, 1)
print(getticks() - time)
Time = 1.65 seconds (same container)
Speeds bounce around so much between both EUO and OEUO that I'd say these are pretty much the same on average. Sorry, no speed help for you with OEUO. There's a 1000 other reasons why you SHOULD use it. Finditem isn't one of them.... ;)
-
But you can iterate through the found items so fast, you could probly use the same info for one or two extra finds... depending on what you're doing, and if you've moved or not... search distance... all that.
-
Yeah, I know that its Sheer Computational Abilities are extremely faster than that of euo, but I was curious if the interaction between the client and it is any better. I think I'll start working on a new version of my suit builder in OEUO since it can just crunch the numbers sooo much faster.
-
interesting.. but are you sure that euo is actually finiding all the properties... event property doesnt always return the actual property in my experience if you go to fast.
-
In this case it was working fine. I wasn't moving around, and that's when event property really falls flat when your character is moving.
-
Here's some code that shows that everything is as it should be (44 items this time; I was doing some fishing)
REMEMBER! If you want to test this, you need my "tm_subs_collection6.lua" collection, and this sample code must be saved with a filename.
dofile("tm_subs_collection6.lua")
time = getticks()
count, stack, items = TM_FindItem("*","c", {UO.BackpackID}, 1)
endtime = getticks() - time
print(string.format("Item count = %d",count))
for i,k in ipairs(items) do
print(string.format("%d: %s",i,k.name.."$"..k.property))
end
print(string.format("time: %f",endtime/1000))
And the results:
Item count = 44
1: Runebook$Blessed
Weight: 1 Stone
Zippy
2: Spellbook$Blessed
64 Spells
3: Necromancer Spellbook$Blessed
17 Spells
4: A Promotional Token$Blessed
Weight: 5 Stones
Use This To RedeemYour Advanced Character
5: A Message In A Bottle$Weight: 1 Stone
6: A Message In A Bottle$Weight: 1 Stone
7: A Message In A Bottle$Weight: 1 Stone
8: A Message In A Bottle$Weight: 1 Stone
9: A Message In A Bottle$Weight: 1 Stone
10: A Message In A Bottle$Weight: 1 Stone
11: A Message In A Bottle$Weight: 1 Stone
12: A Message In A Bottle$Weight: 1 Stone
13: A Message In A Bottle$Weight: 1 Stone
14: A Message In A Bottle$Weight: 1 Stone
15: A Message In A Bottle$Weight: 1 Stone
16: A Message In A Bottle$Weight: 1 Stone
17: A Message In A Bottle$Weight: 1 Stone
18: A Message In A Bottle$Weight: 1 Stone
19: A Message In A Bottle$Weight: 1 Stone
20: Dagger$Weight: 1 Stone
Physical Damage 100%
Weapon Damage 10 - 11
Weapon Speed 2s
Strength Requirement 10
One-Handed Weapon
Skill Required: Fencing
Durability 35 / 35
21: Scissors$Weight: 1 Stone
22: A Message In A Bottle$Weight: 1 Stone
23: A Message In A Bottle$Weight: 1 Stone
24: A Message In A Bottle$Weight: 1 Stone
25: A Message In A Bottle$Weight: 1 Stone
26: Cleaver$Insured
Weight: 2 Stones
Poison Resist 5%
Faster Casting 1
Hit Lightning 48%
Hit Lower Defense 18%
Lower Requirements 50%
Physical Damage 90%
Poison Damage 10%
Weapon Damage 11 - 13
Weapon Speed 2.5s
Strength Requirement 5
One-Handed Weapon
Skill Required: Swordsmanship
Durability 33 / 33
27: A Waterstained SOS$Weight: 1 Stone
28: A Waterstained SOS$Weight: 1 Stone
29: A Waterstained SOS$Weight: 1 Stone
30: A Waterstained SOS$Weight: 1 Stone
31: A Waterstained SOS$Weight: 1 Stone
32: A Waterstained SOS$Weight: 1 Stone
33: Backpack$Weight: 44 Stones
Contents: 1/125 Items, 41/400 Stones
34: A Ship Key$Insured
Weight: 1 Stone
35: An Ancient SOS$Weight: 1 Stone
36: A Waterstained SOS$Weight: 1 Stone
37: A Waterstained SOS$Weight: 1 Stone
38: A Waterstained SOS$Weight: 1 Stone
39: Recall Rune$Weight: 1 Stone
40: Recall Rune$Weight: 1 Stone
41: A Waterstained SOS$Weight: 1 Stone
42: A Waterstained SOS$Weight: 1 Stone
43: A Waterstained SOS$Weight: 1 Stone
44: A Waterstained SOS$Weight: 1 Stone
time: 2.665000
-
So, when you use a dofile("Name of file")
That basically allows you to use all the functions within that file yes?
Hmm..... I'm starting to really like OEUO, although I still think it will be a while before I can fully use it.
-
Really "require("filename")" is better suited for this. I'll probably shift everything. Require is nice because if the file is already loaded, it won't load it again. I was using dofile because I wanted some active feedback to let the scripter know if an OLDER version of a file was loaded, but there might be a dependency on a newer file.
You just need to pick a small project and try OEUO out on it. For me it was easy; I have lots of tools I use to script so I started porting all those things that make scripting easy for me. I haven't written code for file saving, journal handling, list management, etc for a long time. I just rely on my canned subs for that. Once those are in place, then the scripts become easy, even in OEUO.
-
BTW, my UI subs are really making the transition easier. Take a typical EUO function:
sub ReleaseActivePane
namespace push
namespace local ACTIVE
set !pane %1
if !pane = LEFT
{
menu delete EUOLabelLeftTitle
menu delete EUOButtonLeftActive
menu Font Name Arial
menu Font Size 7
menu Font BGColor BtnFace
menu Button EUOButtonLeftActive 52 32 43 17 Active
menu delete EUOButtonDelete
menu delete EUOButtonClear
}
if !pane = RIGHT
{
menu delete EUOLabelRightTitle
menu delete EUOButtonRightActive
menu Font Name Arial
menu Font Size 7
menu Font BGColor BtnFace
menu Button EUOButtonRightActive 328 32 43 17 Active
menu delete EUOButtonActiveDelete
menu delete EUOButtonActiveClear
}
menu Font Size %pane_font_size
namespace pop
return
Turns into:
---------------------------------------------------------------
function ReleaseActivePane(pane)
if pane == "LEFT" then
mm:TM_DeleteControl("EUOLabelLeftTitle")
mm:TM_DeleteControl("EUOButtonLeftActive")
mm:TM_MenuFunction("menu Font Name Arial")
mm:TM_MenuFunction("menu Font Size 7")
mm:TM_MenuFunction("menu Font BGColor BtnFace")
mm:TM_MenuFunction("menu Button EUOButtonLeftActive 52 32 43 17 Active")
mm:TM_DeleteControl("EUOButtonDelete")
mm:TM_DeleteControl("EUOButtonClear")
end
if pane == "RIGHT" then
mm:TM_DeleteControl("EUOLabelRightTitle")
mm:TM_DeleteControl("EUOButtonRightActive")
mm:TM_MenuFunction("menu Font Name Arial")
mm:TM_MenuFunction("menu Font Size 7")
mm:TM_MenuFunction("menu Font BGColor BtnFace")
mm:TM_MenuFunction("menu Button EUOButtonRightActive 328 32 43 17 Active")
mm:TM_DeleteControl("EUOButtonActiveDelete")
mm:TM_DeleteControl("EUOButtonActiveClear")
end
mm:TM_MenuFunction(string.format("menu Font Size %d",pane_font_size))
end
So not much code thrashing occurs to make code work. I already have buttons switching menu elements; the built-in button handler is a rousing success, IMHO.
-
So, when you use a dofile("Name of file")
That basically allows you to use all the functions within that file yes?
Hmm..... I'm starting to really like OEUO, although I still think it will be a while before I can fully use it.
I am working on trying to covert my lumberjacker to work under OEUO and then take it apart to see what is what under the new LUA structure.
-
Cheffe fixed the tm tiles, so lumberjacker should work nicely