Code: Select all
for i = 0, RoMScript("GetTitleCount()") do
local name, titleid, geted = RoMScript("GetTitleInfoByIndex("..i..")
if titleid == 530897 then
-- have title
break
end
end
People with the programming skills know this can be done with an in game loop that will be much faster, example
Code: Select all
RoMCode("for i = 0, GetTitleCount() do n,t,g=GetTitleInfoByIndex(i) if t==530897 then a = {g} end end")
Now RoMScripts can be any length. This is useful because now you can create long complex code and execute it in 1 RoMScript. A side affect of this is if the command is longer than 255 characters it will take twice as long. If it's more than 510 characters it will take 3 times as long, etc. So the usefulness of using really long code will be limited by how long it will take.
The trick I want to introduce is creating an in game function instead. When you want to use some really long code it might be beneficial to do something like this.
In the onload of your waypoint file create the in game function.
Code: Select all
RoMCode([[
function myfunction(arg)
...
...
-- some really long code
...
...
end
]])
Code: Select all
RoMScript("myfunction("..argument..")")