ScriptUO
Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: Cstalker on February 25, 2012, 08:20:55 PM
-
here i go trying to learn this stuff and i keep getting stuck. It may be my way of thinking. maybe ya'll can help get my mind in the right direction.
This is one of my basic gosub (function now) that i used in euox
sub corpse
If %1 = open
{
nextcpos 666 369
wait 2
set #lobjectid %CORPSE
wait 2
event macro 17 0
wait 2
}
If %1 = close
{
set #lobjectid %CORPSE
wait %vswait
click 741 425 r
wait %vswait
}
Return
Now how would this convert over to OEUO? I am assuming that i will have to have another function that will handle finding the corpse, and that could be called from inside this function and that is going to be another bag of worms to tackle. First i want to grasp this simple part.
-
Its been a while since i jumped into lua but this would it be i think:
function Corpse(Status,CorpseID)
if Status == "open"
then
UO.NextCPosX = 666
UO.NextCPosY = 369
wait(100)
UO.LObjectID = CorpseID
wait(100)
UO.Macro(17,0)
wait(100)
end
if Status == "Close"
then
UO.LObjectID = CorpseID
wait(vswait)
UO.Click(741,525,false,true,true,false)
wait(vswait)
end
end
in lua you sending arguments via declaration.
so you have Corpse("Open",ID) in my example to do , to use this function.
As you maybe noticed i addet an ID in the Argument list. In your Example you have the function "Corpse" and the ID "Corpse". In lua we dont have the splitter like % , so Corpse would be Corpse. To avoid you could do 3 different ways:
- Dont call the Scriptvariable Corpse
or
- Call the function OpenCorpse
or
- Use the function as i showed
Looking Command Overview (http://www.easyuo.com/forum/viewtopic.php?t=43220) or Variable Overview (http://www.easyuo.com/forum/viewtopic.php?t=43328) can be always pretty helpful
Crome
-
thank, i will explore this in the morning.
Oh one thing and i think it may click.
in euox i would use that by
gosub corpse open
would i use it in oeuo like this
Corpse (open,CorpseID)
-
In lua arent Gosub or Gotos exist. just call functioname(arguments).
-
function Corpse(Status,CorpseID)
if Status == "open"
then
UO.NextCPosX = 666
UO.NextCPosY = 369
wait(100)
UO.LObjectID = CorpseID
wait(100)
UO.Macro(17,0)
wait(100)
end
if Status == "Close"
then
UO.LObjectID = CorpseID
wait(vswait)
UO.Click(741,525,false,true,true,false)
wait(vswait)
end
end
CorpseID=1107006339
Status=open
Corpse ()
[code\]
ok when i do this it does not trigger the open section of the function
i have tried
Corpse (open)
Corpse (open,CorpseID)
Corpse (Status,CorpseID)
and
Corpse (open,1107006339)
and none are triggering the open section. I step through it with the f7 so it is going.
I will keep at it and sooner or later i will get it.
or am i thinking all wrong. I read the example on easyuo site and still just not grasping it
-
ok, got it, i was not using the" " around open
corpse ("open", CorpseID)
Thanks again.
-
ok, got it, i was not using the" " around open
corpse ("open", CorpseID)
Thanks again.
Without " it things that u using a variable or function. And when not filled open with something then it would return nil . Also sending nil and never would jump into the right parts.
Iam not sure any more if lua were case sensitive with strings. So better stay prepared to be sensitive:)
-
yes its still case sensitive, so Close is not the same as close.
-
yes its still case sensitive, so Close is not the same as close.
You could do string.lower (stringvariable) at each called String. So you avoid casesentive at Strings because all will be lowerchar translated.