Page 1 of 1

Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 12:13 pm
by botje
i was thinking, seeying it gets stuck reguralary for me, would it not be possible to enhace it some more?

was thinking about the line of ...

well, since i saw there is a getzone id function, would it not be possible to dio a while loop checking if zoneid has changed?

because we can get zoneid when we execute the function, we could store it and check if it changed right?

can anybody help me out with this? i suck at lua :)

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 5:10 pm
by lisa
reason for the waitforloadingscreen function is while you have a loading screen you can't do any macros as it will error out saying you need to define a macro key.

What is the issue you are having with the function?
Did you know it has a argument for maximum time to wait?

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 5:16 pm
by botje
well, it mostly just stops, so im standing there, without it detecting loading is done.

ofcourse i could use the timeout, but what if i didnt go in instance? then i would load next waypoint, and get in trouble :P

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 5:20 pm
by lisa
reason I mention the timer is you can set it to like 10 seconds, usually more then enough time to actually load a new zone and then after that time check zone Id.
By using the time on the function you should be able to reduce the chance of trying to check zone while screen is still loading =)

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 5:23 pm
by botje
yes, but i dont know how to check zoneid... :oops:

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 5:59 pm
by Administrator

Code: Select all

/script DEFAULT_CHAT_FRAME:AddMessage(GetZoneID());

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 6:07 pm
by botje
i see, thanx ^^

and how would i use that in a checking function?

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 7:06 pm
by lisa

Code: Select all

local zone = RoMScript("GetZoneID()")
if zone == *** then
blah blah
else 
blah blah
end
obviously change the *** to the zone ID you want and the blah blah to code you want to do if in zone or not.

Re: Enhancing the waitforloadinscreen function?

Posted: Wed Jul 20, 2011 7:10 pm
by botje
i see, thank you very much :)

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Thu Jul 21, 2011 10:06 am
by botje

Code: Select all

local zone = RoMScript("GetZoneID()")

while zone ==  11
keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
keyboardHold( settings.hotkeys.JUMP.key );
yrest(250)
keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
keyboardRelease( settings.hotkeys.JUMP.key );
waitForLoadingScreen(10);
end

loadPaths("DragonFang/cyclops");
would that work?

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Thu Jul 21, 2011 10:23 am
by botje
nvm, works perfectly :)

hmm, now it doesnt xd

failed to compile and run Lua code...

Re: Enhancing the waitforloadinscreen function?

Posted: Thu Jul 21, 2011 10:55 am
by botje

Code: Select all

local zone = RoMScript("GetZoneID()")
		while zone ==  11 do
			local zone = RoMScript("GetZoneID()")
			keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
			yrest(250)
			keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
			yrest(250)
			waitForLoadingScreen(10);
		end
		
		loadPaths("DragonFang/cyclops");
edit:

now i got this, it enters Cyclops, but doesnt detect the zone change O.o

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Thu Jul 21, 2011 11:32 am
by rock5
It should be

Code: Select all

while zone == 11 do
I don't see that working anyway. zone is never updated so it wont change value.

Also blindly walking forward is a bit risky. Isn't there any room to place a waypoint at the teleport location? If so, I would do it like this.

Code: Select all

<!-- # 51 --><waypoint x="-32662" z="-14686" y="669">
		player:target_NPC("Kalice");
		sendMacro("ChoiceOption(1);");
		waitForLoadingScreen(10);
	</waypoint>
<!-- # 52 --><waypoint x="-38174" z="-9280" y="1061" tag="again"></waypoint>
<!-- # 52.5 --><waypoint x="xxxxxx" z="xxxxx" y="1061" >
		waitForLoadingScreen(10);
		if RoMScript("GetZoneID()") == 11 then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("again"))
		else
			loadPaths("DragonFang/cyclops");
		end
	</waypoint>
What this does is, after the first teleport, it walks to the teleport waypoint then waits for loading screen. If it doesn't change zone then it goes back to waypoint 52 and walks into the teleport again. It will repeat this until it succeeds. This is safer as it's just walking between 2 waypoints.

Re: Enhancing the waitforloadinscreen function?

Posted: Thu Jul 21, 2011 11:38 am
by botje
aaah, so thats it xd

thats stupid :P

and thanx, ill make the modifications to get back to previous point :)

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Thu Jul 21, 2011 7:40 pm
by rock5
An idea occured to me this morning, while I was lying in bed, that will improve "waitForLoadingScreen". It's not realy related to your problem but some people have said that their computers were so fast that the function didn't detect the loading screen. In those cases it would get stuck in a loop waiting for a loading screen that's already gone. It occured to me that the player address changes every time it teleports so I could add a check for that aswell. Then it can be sure 100% that it teleported. I'll have to add that to the function.

Re: Enhancing the waitforloadinscreen function?

Posted: Fri Jul 22, 2011 2:19 am
by botje
well, i think thats precisely my problem, i have a fast quadcore, so i think its just that, way to fast :)

Botje

Re: Enhancing the waitforloadinscreen function?

Posted: Fri Jul 22, 2011 2:42 am
by rock5
ok, in that case I'll add it to my next commit.

Re: Enhancing the waitforloadinscreen function?

Posted: Sat Jul 23, 2011 7:33 am
by rock5
Added to revision 619.

waitForLoadingScreen should now 100% detect when it teleports.