Waiting for loading screen function.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Waiting for loading screen function.

#1 Post by rock5 » Fri Sep 24, 2010 1:51 am

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.
Last edited by rock5 on Mon Oct 25, 2010 8:30 pm, edited 2 times in total.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

miximixi007
Posts: 94
Joined: Sat Apr 17, 2010 1:18 pm

Re: Waiting for loading screen function.

#2 Post by miximixi007 » Fri Sep 24, 2010 4:53 am

useful for change character.
I used something like this:
repeat
press F1
delay 1000
until Targetname == player.Name and Targetname~=nil

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Waiting for loading screen function.

#3 Post by rock5 » Fri Sep 24, 2010 11:18 pm

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

miximixi007
Posts: 94
Joined: Sat Apr 17, 2010 1:18 pm

Re: Waiting for loading screen function.

#4 Post by miximixi007 » Mon Sep 27, 2010 10:39 pm

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

runensammler
Posts: 13
Joined: Mon Apr 06, 2009 6:20 am

Pointer changed - but i got it :)

#5 Post by runensammler » Sun Oct 24, 2010 12:18 pm

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

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: Waiting for loading screen function.

#6 Post by Andreas_B » Sun Oct 24, 2010 7:26 pm

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;

WhiteTiger
Posts: 84
Joined: Tue Jun 22, 2010 8:06 am

Re: Waiting for loading screen function.

#7 Post by WhiteTiger » Sun Oct 24, 2010 8:04 pm

Code: Select all

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

runensammler
Posts: 13
Joined: Mon Apr 06, 2009 6:20 am

Re: Waiting for loading screen function.

#8 Post by runensammler » Mon Oct 25, 2010 2:25 pm

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.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Waiting for loading screen function.

#9 Post by rock5 » Mon Oct 25, 2010 7:49 pm

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Pointer changed - but i got it :)

#10 Post by rock5 » Mon Oct 25, 2010 8:28 pm

runensammler wrote:New pointer address is : 0x00A0A9F8
I've checked it. It is correct. Well done. I'll update the first post.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

uelkfr
Posts: 8
Joined: Wed Sep 01, 2010 10:30 am

Re: Waiting for loading screen function.

#11 Post by uelkfr » Wed Nov 03, 2010 11:37 pm

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?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Waiting for loading screen function.

#12 Post by rock5 » Thu Nov 04, 2010 12:43 am

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

woah
Posts: 44
Joined: Sat Dec 17, 2011 5:27 pm

Re: Waiting for loading screen function.

#13 Post by woah » Sun Jan 01, 2012 4:10 pm

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?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Waiting for loading screen function.

#14 Post by lisa » Sun Jan 01, 2012 8:06 pm

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.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Waiting for loading screen function.

#15 Post by rock5 » Sun Jan 01, 2012 9:00 pm

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests