ScriptUO

Scripting Resources & Utilities => OEUO => OpenEUO Scripting Tutorials => Topic started by: Crome969 on July 29, 2011, 11:16:23 AM

Title: Idea to fix Repeat\Goto
Post by: Crome969 on July 29, 2011, 11:16:23 AM
Hello Community,
i noticed in TMs Pathfind that he working a lot with breaks
i thought a little bit about this issue and have maybe a solution:

function Goto(Mode,Statement)
if(Mode=="Set")then
myMode = Statement
end
if(Mode=="Get")then
Return MyMode
end
end




while(Goto("Get",false)==true)do -- ask if Goto true
.... --Your Code
if(...)and(Goto("Get",false)==true)then
... --Your Code
else
Goto("Set",true) -- set Goto to false and end loop
end
end

Its nearly like i solve my Problems

Another Possibility is to insert the looped Code in a function with a return
Example:

function Yourfunction(Yourparameter)
.. -- Your Code here
return "anyStatement" -- true or false
end

and then make


a = false
while(Yourfunction(Yourparameter)==false)do
 a = Yourfunction(Yourparameter)
end


Iam fresh to Openuo but maybe this Idea helps someone of you

best Regards Crome