ScriptUO
Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: Tidus on October 13, 2010, 04:32:35 PM
-
Since there is no goto or gosub... how do i do flow on LUA? Make sure it goes from one sub to the next. I'm guessing subs are just functions and returns are ends.
-
Since there is no goto or gosub... how do i do flow on LUA? Make sure it goes from one sub to the next. I'm guessing subs are just functions and returns are ends.
gosub = function now
return = end
been looking stuff up and chatting with endless
-
So does
repeat
function now carveleather
until UO.CliLogged == Yes
Work for the goto?
-
So show me this in OEUO:
repeat
gosub 1
gosub 2
gosub 3
until #false
sub 1
sub 2
sub 3
-
So does
repeat
function now carveleather
until UO.CliLogged == Yes
Work for the goto?
not function now. it is function *now it is
repeat
function carveleather
until UO.CliLogged == Yes
-
Specifically for Cerveza's question:
function One()
print("1")
end
---------------------
function Two()
print("2")
end
---------------------
function Three()
print("3")
end
---------------------
---------------------
repeat
One()
Two()
Three()
until false
Note you need to put your functions up before the code that actually executes.
-
So does
repeat
function now carveleather
until UO.CliLogged == Yes
Work for the goto?
not function now. it is function *now it is
repeat
function carveleather
until UO.CliLogged == Yes
function carveleather
end
repeat
carveleather
until UO.CliLogged == Yes
-
wow...
so main loops per say are all at the bottom now. hehe. comically it makes sense since we all feel like our worlds are upside down :P
-
basically this language reads everything and then acts upon what it needs to.
-
Would this work?
dofile("tm_subs_v31.lua")
function setup
LeatherMenu = MenuInfo:New()
LeatherMenu:TM_MenuFunction("menu Edit RunebookID 12 216 73 yourrunebook")
repeat
if UO.MenuButton ~= N/A
{
if UO.MenuButton == GetRunebook
{
set UO.targcurs 1
while UO.TargCurs == 1
wait 1
yourrunebook = UO.LTargetID
LeatherMenu:TM_MenuFunction("menu Edit RunebookID 12 216 73 yourrunebook")
UO.MenuButton = N/A
}
if UO.MenuButton == GetButcher
{
set UO.TargCurs 1
while UO.TargCurs == 1
wait 1
cleaver = UO.LTargetID
LeatherMenu:TM_MenuFunction("menu Edit ButchersID 12 260 73 cleaver")
UO.MenuButton = N/A
}
}
until UO.MenuButton = EUOButton1
UO.MenuButton = N/A
LeatherMenu:TM_DeleteControl("EUOButton1")
LeatherMenu:TM_MenuFunction("menu get HouseCheck")
if UO.MenuRes == true
commbox = true
LeatherMenu:TM_MenuFunction("menu get BankCheck")
if UO.MenuRes == true
commbox = false
LeatherMenu:TM_MenuFunction("menu get Chiv")
if UO.MenuRes == true
travel = SJ
LeatherMenu:TM_MenuFunction("Menu get Recall")
if UO.MenuRes == true
travel = RE
LeatherMenu:TM_MenuFunction("menu get bankrunes")
bankrunes = UO.MenuRes
LeatherMenu:TM_MenuFunction("menu get monsterrunes")
runeamounts = UO.MenuRes
LeatherMenu:TM_MenuFunction("menu get houserunes")
houserunes = UO.MenuRes
LeatherMenu:TM_MenuFunction("menu get maxleather")
leather = UO.MenuRes
regularfinal = 0
spinedfinal = 0
hornedfinal = 0
barbedfinal = 0
corpseid = YFM_FEX_QEX
cutleather = JJG
monster = AE_DE_FE_AF_CD_NG_IG_XG_YG_ZF_EG --; Lizardmen_Wyvrnn_Dragon_Cow_Bull_Goat_LLAMA
arti = LSW_YKQ_OKQ_QKQ_MKQ_RSW_QMH_SKQ_ALQ --;The Arties that Drop in Dungeons
delay = 8 --;
ignoretimer = ( #sCnt + 1200 )
wait = You_must_wait_to_perform_another_action
bandies = ZLF
bankposition = 1
houseposition = bankrunes + 1
End
-
Run it. Looks like you have a bunch of "set" commands in there. In Lua you just need the expression "x = 1" instead of "set x 1"
-
I'm really serious, you shouldn't even attempt a GUI based script until you've played a bit more with the Lua syntax or else you are going to get REALLY frustrated. Probably more so since we're not sure where Cheffe is headed with the GUI thing anyhow.
-
yeah... true.. might just have to make this basic like the first one was....
-
-
-
My finditem subs have ignoreitem
-
Also, your syntax is off. You should code just a few lines, the test. Baby steps.
-
Also, your syntax is off. You should code just a few lines, the test. Baby steps.
That is why i am posting it. I don't know the LUA language enough to know the syntax. Also the OEUO isn't running right on my client for some reason.
-
download the latest version of openEUO...
-
Nice work, looks like people finally got over the initial shock and are steppin up. :)
-
I highly recommend the Lua book:
http://www.amazon.com/Programming-Lua-Second-Roberto-Ierusalimschy/dp/8590379825/ref=sr_1_1?ie=UTF8&qid=1287039173&sr=8-1
Also, I keep lua.org open all the time. There is much useful information in there, at least enough to get you working with the syntax. If you don't have that right then Lua will just complain and exit.
-
Ok so flow goes like this now...
subs
mainloop
What about these huge subs, like journal scanning or ocr etc.... You have to put in thousands of line of code before the mainloop?
And what about calling stuff? Like KalOCR... how do you go about calling that script up when needed, and interpret the results?
What about sending arguments to a sub?? %1, %2, %3 etc...
-
What about these huge subs, like journal scanning or ocr etc.... You have to put in thousands of line of code before the mainloop?
I would cut all those subs out into a standard library and add one line to top of script
dofile('mylibrary.lua')
And what about calling stuff? Like KalOCR... how do you go about calling that script up when needed, and interpret the results?
see above .. dofile('kalocr.lua') will load all his subs into your script.. you just dont see it and you can call all his subs like they were in your script.
What about sending arguments to a sub?? %1, %2, %3 etc...
function myfunction(arguments)
function enstest(fistarg, secondarg, thirdarg)
return firstarg + secondarg + thirdarg
end
x = enstest(1,2,3)
print(x) -- should be 6