Page 1 of 1

Waiting for loading screen function.

Posted: Fri Sep 24, 2010 1:51 am
by rock5
Now that I've found a pointer that tells me if the loading screen is showing, I thought it might be a good idea to add a "wait for game to be ready" function to the rombot. You'd be able to use it after any action that causes the loading screen to appear eg, teleporting, entering your house, logging off and loading another character etc. So you wouldn't need a yrest pause and have to try and guess how long to wait for.

What do you think?

Currently it looks like this.

Code: Select all

	function waitForLoadingScreen()
		if memoryReadBytePtr(getProc(), 0x00A0A9F8, 0x0C) == 0 then -- wait for loading screen
			repeat
				yrest(1000)
			until memoryReadBytePtr(getProc(), 0x00A0A9F8, 0x0C) == 1
		end
		repeat -- wait until loading screen gone
			yrest(1000)
		until memoryReadBytePtr(getProc(), 0x00A0A9F8, 0x0C) == 0
	end
Btw the pointer is a byte value
Address : A0A9F8
Offset : 0C
It equals 1 when the loading screen is showing and 0 when it's not.

Re: Waiting for loading screen function.

Posted: Fri Sep 24, 2010 4:53 am
by miximixi007
useful for change character.
I used something like this:
repeat
press F1
delay 1000
until Targetname == player.Name and Targetname~=nil

Re: Waiting for loading screen function.

Posted: Fri Sep 24, 2010 11:18 pm
by rock5
miximixi007 wrote:useful for change character.
I used something like this:
repeat
press F1
delay 1000
until Targetname == player.Name and Targetname~=nil
I don't see how you could use that from rombot. For player.Name to change wouldn't you need to run player:update()? And wouldn't running player:update(), before the game is ready, cause errors?

My way only checks 1 byte and has no trouble checking it at any time, even when at the login screen.

Re: Waiting for loading screen function.

Posted: Mon Sep 27, 2010 10:39 pm
by miximixi007
sorry.I wrote it with third party script.include autocreate macro.cause i'm not good at lua.

Code: Select all

Sub Macro()
        Mem=  HMEM.Read32Bit(hwnd,MacroBase)
        MacroPoint = Mem+&H14
        MacroIcon = HMEM.Read8Bit(hwnd,MacroPoint)
        Delay 100
        Dprint MacroIcon
        If MacroIcon>0 And MacroIcon <= 60  Then
            call SendTestCommand
            If OutDate=true Then
                Dprint   "OK"
                Exit Sub
            Else
                Call CreateMacroLnk()
                Exit Sub
            End If
        Else        
            HMEM.Write32Bit  hwnd,MacroPoint,1        'create macro
            Call CreateMacroLnk()
            Exit Sub
        End If
End Sub

Sub CreateMacroLnk()
    HApp.SendKeyPress  Hwnd,"Enter"
    Delay 300
    HApp.SendKeyPress  Hwnd,"Caps Lock"
    Delay 200
    HApp.SendString    Hwnd,"/y "&"/script PickupMacroItem(1) PickupAction(10) PickupBagItem(50);"
    Delay 500
    HApp.SendKeyPress  Hwnd,"Enter"
    Delay 300
End Sub

Pointer changed - but i got it :)

Posted: Sun Oct 24, 2010 12:18 pm
by runensammler
Hi rock.
rock5 wrote: What do you think?
I love your pointer.
I use it inside some Rombot scripts and in my steering program (written in Autoit)
rock5 wrote: Currently it looks like this.

Code: Select all

	function waitForLoadingScreen()
		if memoryReadBytePtr(getProc(), 0x00A08960, 0x0C) == 0 then -- wait for loading screen
			repeat
				yrest(1000)
			until memoryReadBytePtr(getProc(), 0x00A08960, 0x0C) == 1
		end
		repeat -- wait until loading screen gone
			yrest(1000)
		until memoryReadBytePtr(getProc(), 0x00A08960, 0x0C) == 0
	end
Btw the pointer is a byte value
Address : A08960
Offset : 0C
It equals 1 when the loading screen is showing and 0 when it's not.
My funtion is very similar to yours.

But ....
Since last Update the Pointeraddress has changed - i have tried to find out but I m a noob in this things.

Please help.

Edit:
Ask aunt google and find some how to's and think a little bit, try something, try second time, get frustrated, try another thing, and finaly
you got it:

New pointer address is : 0x00A0A9F8

Re: Waiting for loading screen function.

Posted: Sun Oct 24, 2010 7:26 pm
by Andreas_B
Pointers will change over time

During Loadingscreen WorldFrame is not visible. Therefore I use a similar function:

Code: Select all

function waitForWorldFrame()

    local visible = false;
   
    repeat visible = RoMScript("WorldFrame:IsVisible();"); yrest(100); until visible;
    if visible == true then    -- wait for invisible WorldFrame
        repeat
		      visible = RoMScript("WorldFrame:IsVisible();");
            yrest(50);
        until visible ~= true;
    end;
    repeat                     -- wait for visible WorldFrame
        visible = RoMScript("WorldFrame:IsVisible();");
        yrest(50);
    until visible == true;

end;

Re: Waiting for loading screen function.

Posted: Sun Oct 24, 2010 8:04 pm
by WhiteTiger

Code: Select all

while not RoMScript(''UnitExists("player")') do
     yrest(100)
end
ftw

Re: Waiting for loading screen function.

Posted: Mon Oct 25, 2010 2:25 pm
by runensammler
Both the Worldframe and the Player exists methods are nice, but i use the pointer for my
Autoit steering programm.
I control the about 7 Accounts (=56 chars) and most of the chars have different waypoints for different tasks.

Re: Waiting for loading screen function.

Posted: Mon Oct 25, 2010 7:49 pm
by rock5
First of all both those methods use 'RoMScript' which is a bit unreliable and slow. Second, I'm surprised you are not getting errors when RoMScript executes but you are not currently in the game. I'm pretty sure you will get errors if it is at the character selection screen for instance. Please correct me if I'm wrong.

Re: Pointer changed - but i got it :)

Posted: Mon Oct 25, 2010 8:28 pm
by rock5
runensammler wrote:New pointer address is : 0x00A0A9F8
I've checked it. It is correct. Well done. I'll update the first post.

Re: Waiting for loading screen function.

Posted: Wed Nov 03, 2010 11:37 pm
by uelkfr
Do you have the old address and offset for 3.0.4? :)

I would thank to Administrator for adding this address to address.lua and update.lua.

We just need loadingscreenPtrUpdatePattern and loadingscreenPtrUpdateMask?

Re: Waiting for loading screen function.

Posted: Thu Nov 04, 2010 12:43 am
by rock5
uelkfr wrote:Do you have the old address and offset for 3.0.4? :)

I would thank to Administrator for adding this address to address.lua and update.lua.

We just need loadingscreenPtrUpdatePattern and loadingscreenPtrUpdateMask?
The old address was A08960. I found it in 1 of the posts above.

The pattern and mask haven't been added yet. I've given the new info to Administrator recently so I expect it will be added soon. It will be for the current version though.

Re: Waiting for loading screen function.

Posted: Sun Jan 01, 2012 4:10 pm
by woah
Hi rock, i have a problem with your waitforloadingscreen() function. It just waits forever after loading and wont move on to the next waypoint. Have the pointers changed or something?

Re: Waiting for loading screen function.

Posted: Sun Jan 01, 2012 8:06 pm
by lisa

Code: Select all

waitForLoadingScreen()
will wait forever until it gets the loading screen and then loading screen finishes.

Code: Select all

waitForLoadingScreen(30)
will do the same but will wait a maximum of 30 seconds and then stop looking for loading screen.

the number can be changed to suit what you want, I don't think there is a minimum or maximum.

Re: Waiting for loading screen function.

Posted: Sun Jan 01, 2012 9:00 pm
by rock5
It is possible that if something delays the script after you start the teleport then the loading screen might come and go before waitForLoadingScreen() starts, in which case it will be waiting for a loading screen that has already gone. For instance, lately I've been using a bit of code that talks with an npc, selects an option, responds to the money popup and then waits for the loading screen. If there was no popup, eg if I had autopay enabled in streamline, then there would be a big enough delay while it tried to find the popup, that it would totally miss the loading screen.

I'm thinking of creating a "npcteleport" function that checks the current zone name, talks to the npc, selects an option, answers a popup if neccessary then waits for the zone to change. Should be very reliable.