ScriptUO
Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: TrailMyx on August 23, 2010, 10:22:07 AM
-
Non-blocking timers, spellcast/runebook subs, finditem suite of subs, etc. All good stuff coming soon, and meant to look and work more like what everyone is used to from EUO.
-
Non-blocking timers, spellcast/runebook subs, finditem suite of subs, etc. All good stuff coming soon, and meant to look and work more like what everyone is used to from EUO.
*STAMP* Officially converted. You have been approved to spoon with Cheffe.
-
*STAMP* Officially converted. You have been approved to spoon with Cheffe.
When I port the heartwood quester, you can officially label me converted. At the moment, I'm amused. In the mean time, yout position of chief spooner is safe. :)
-
In the mean time, your position of chief spooner is safe. :)
ROFLMFAO !!!!!!!!!!!! :P :P :P :P :P :P :P :P :P :P :P
-
Guess i need to start learning Lua...
-
It's probably a good time to learn the language. As for OEUO, Cheffe is still trying to create a scripting development model, so I'm avoiding creating any large scripts because there is some uncertainty regarding the final vision of OEUO.
But I think tools are safe at the moment to move forward with.
-
BTW, my finditem sub is really turning out nice. ;)
-
So this will be pretty cool.. Take this little snippet for example:
items = {}
count = 0
stack = 0
count, stack, items = TM_FindItem("hvf_pof","cg", "*", 1)
if count > 0 then
print(string.format("Found: %d, total stack size = %d",count, stack))
end
The first argument is what you might be looking for. In this case it's ruby stacks and gold stacks. The second argument suggest that you want to look at both the ground and containers. The third argument is a wildcard for the containers to look inside all open containers. You can easily give this a list like "XXXYY1_XXXYY2" and it will only look inside those two containers. The 4th argument is the distance to look and report found items.
The return values are intersting. The "count" argument is the resulting count of all items found. The "stack" argument is a sumation of all stack sizes found for the search. For this example, the returned value would be the summation of all gold stack values as well as all ruby stack values (yes, I know that doesn't make any sense....). The final return value "items" is a table of all items returned that matched the search criterion. You can iterate across this table and see the specific information found:
for x,k in pairs(items) do
print(string.format("findid for this item is %d", k.findid))
end
You'll find that you don't have to use the old EUO numbering scheme if you don't want. The function also works with tables of numbers:
items = {}
count = 0
stack = 0
count, stack, items = TM_FindItem({123456, 2340923498},"c", {6767658}, 1)
if count > 0 then
I'll post this up when I have a bit more testing done.
-
I also rolled into the finditem subs automatic property scan for each returned item. One stop shopping.
I've also got the runebook/spellcast subs working well. It's hard to get the spellcast sub solid, so I tried to very closely port it from the EUO world since that one has been worked to death over the years. But I've got all the subs you guys are used to using:
TM_TravelFromObject
TM_RandomRunebookTravel
TM_TravelFromNamedRunebook
TM_TravelFromRunebook
TM_GumpWaitAndSize
TM_GumpWait
TM_NewCastSpell
Now I think I'll start working on the rail engine.
-
very sweet deal TM...
-
Very nice ... so is Lua relatively easy once you adjust.
-
Very nice ... so is Lua relatively easy once you adjust.
Actually it is. I'm finding it kinda hard to go back to EUO when I've been doing tools in OEUO. There are some serious annoyances with Lua though. For this to be a complete scripting language, it really should have a "continue" statement. It's got a "break", but no continue. Kinda lame if you ask me. Also not having a "switch/case" structure seems a little odd. "elseif" works ok, but it's not as clear.
Just keep your fingers crossed that Cheffe can straighten out the multithreaded issue. That'll be when I go all-in. Until then, I'm just dabbling.
-
I'm actually looking forward to scripting directly into OEUO. The last few things I've written have been ports of existing code. My runebook subs were pretty convoluted, but bulletproof from EUO, so I wanted to bring that stability directly into OEUO. Same goes for the journal scanner. The finditem subs are a little bit better since they are just improving on the existing item locate ability of Lua/OEUO. Really, there's a little less basic functionality to OEUO, but you can quickly build up waaaay more functionality with simple helper functions. You'll see what I mean when I publish my finditem stuff. Should be soon now, I just have to do a bit of documentation.
-
One of the main things i will be looking forward to is just library functions maintainablity. EUO has needed an include statment desperatly and that alone is reason to switch once its stable in my book.
-
My files are starting to bristle with that exact thing. From my runebook/spellcast subs:
dofile("tm_oeuo_advjournalscan10.lua")
dofile("tm_subs_collection5.lua")
---------------------------------------------------------------
function TM_NewCastSpell(whichspell, whichtarget, castretrymax, waitdelay, recovery_delay)
...
I'm pulling in my journal scanner and a subs collection that includes non-blocking timers.
But you're right, definitely needed feature.
Real file handling is what I'm really looking forward to.
-
The rail engine is coming along nicely. Those that have used this before will be really impressed with the load times. Probably won't have time to finish it this weekend, however.
Just for giggles, I loaded one of SuperSlayers rails to test the functions:
Rail index = 0
Load time = 0.019000 sec
Engine Version = 41
Current Engine command = NONE
Current server mode = SUBROUTINE
Current server status = IDLE
Current rail index = 0
Current rail waypoints = 59
Rail name from index = Luna_MSL7
Current rail name = Luna_MSL7
Present waypoint in current rail = 0
Rails loaded = 1
And a rail that's over 1000 waypoints:
Rail index = 0
Load time = 0.754000 sec
Engine Version = 41
Current Engine command = NONE
Current server mode = SUBROUTINE
Current server status = IDLE
Current rail index = 0
Current rail waypoints = 1084
Rail name from index = worldtour
Current rail name = worldtour
Present waypoint in current rail = 0
Rails loaded = 1
-
So that second rail that takes forever in EUO takes less than a second in LUA? I thought the script had gone into a loop the first time I did it. Pretty powerful illustration.
-
So that second rail that takes forever in EUO takes less than a second in LUA? I thought the script had gone into a loop the first time I did it. Pretty powerful illustration.
It takes about 17 seconds with EUO to load. Funny thing about the OEUO code; it's a terrible hack to get it working to test with, so I know I could probably make it 100 times faster. So for crappy inefficient code to run 22x faster is kinda funny.
-
The rail engine is ALIVE! MUAHAHHAHAHA
-
Only thing stopping me from jumping headlong in is the lack of a usable UI...
-
Only thing stopping me from jumping headlong in is the lack of a usable UI...
I hear ya. I've tried a couple ideas to try and allow for an asynchronous method to run a script and manage the UI much like what EUO does. To date, I haven't found a good way. I thought I was on to something with nested timers, but since you can only have one running per Obj instance, it's kinda hard to work it. The only thing that will fix this is to allow for 2 separate threads per script. One to handle the UI, and the other to manage the script.
I hope Cheffe gets this worked out soon; I'd love to start working that aspect of OEUO.
-
I'll be posting my find item info for OEUO this weekend. That one is nice because it gives you a quick overview of how to integrate a usable UI into your OEUO stuff. Also, it's not written with any "advanced" programming; it's pretty basic. I'll even dissect it verbally and try and explain in detail how each part works and make a little tutorial out of it.
But hopefully it'll be enough for you guys to start playing with a complete graphical script; and rip it up to see how it works.