CPawn error occasionally during load screen.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

CPawn error occasionally during load screen.

#1 Post by lisa » Sun Jan 23, 2011 9:31 am

I have been getting a CPawn error occasionally since last update. It happens for me during character resurection load screen.
My guess is it is trying to update during load screen and gets a nil value.

Doesn't happen all the time so I am guessing that a timer has been adjusted or maybe a waitforloadscreen function has been altered.
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: CPawn error occasionally during load screen.

#2 Post by rock5 » Sun Jan 23, 2011 9:56 am

I can't see any changes to resurrect() for ages and it doesn't use waitForLoadingScreen().

It looks like it only ever had the WAIT_TIME_AFTER_RES pause which is 8000ms which doesn't seem much.

If you can confirm that the loading screen appears I could always add a waitForLoadingScreen().
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: CPawn error occasionally during load screen.

#3 Post by lisa » Sun Jan 23, 2011 10:10 am

It is definately only during loading screen when trying to resurect, killed a character non stop for about an hour testing it. Amazing how easy they die with no hp potions lol

It wasn't everytime though, occasionally the load screen would take longer and that's when the error came up. Would depend on how much I have PC doing at the time, if I load up several RoM clients and a few web browsers then it tends to get a little longer on the load screen.
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: CPawn error occasionally during load screen.

#4 Post by rock5 » Sun Jan 23, 2011 11:05 am

Ok I've added waitForLoadingScreen() after resurrection. That should fix it.
  • 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

j19861986
Posts: 37
Joined: Sun Jan 16, 2011 1:01 am

Re: CPawn error occasionally during load screen.

#5 Post by j19861986 » Fri Feb 25, 2011 6:53 am

I got it also, also with waitForLoadingScreen() option...

look

Code: Select all

	<!-- # 43 --><waypoint x="-20792" z="6228" y="-202">			yrest(1500);
		player:target_NPC("Maylee");
		yrest(1500); 
		sendMacro("ChoiceOption(4);");
				waitForLoadingScreen();			</waypoint>
	<!-- # 44 --><waypoint x="-21967" z="3935" y="-149">		player:merchant("Pierdon");
Attachments
CPAWN UPDATE.jpg

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: CPawn error occasionally during load screen.

#6 Post by JackBlonder » Fri Feb 25, 2011 7:07 am

I can confirm this.
Sometimes there is a Cpawn Error when using waitforLoadingScreen.
And as Lisa said it depends on how much your CPU has to do.

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

Re: CPawn error occasionally during load screen.

#7 Post by rock5 » Fri Feb 25, 2011 7:17 am

j19861986 wrote:I got it also, also with waitForLoadingScreen() option...

look

Code: Select all

	<!-- # 43 --><waypoint x="-20792" z="6228" y="-202">			yrest(1500);
		player:target_NPC("Maylee");
		yrest(1500); 
		sendMacro("ChoiceOption(4);");
				waitForLoadingScreen();			</waypoint>
	<!-- # 44 --><waypoint x="-21967" z="3935" y="-149">		player:merchant("Pierdon");
The image shows that it was already heading to waypoint 44. That means it had already finished with waypoint 43. Which means the error happened after waitForLoadingScreen() had already finished.

So the problem was not with waitForLoadingScreen().
  • 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

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: CPawn error occasionally during load screen.

#8 Post by JackBlonder » Fri Feb 25, 2011 7:33 am

I think it's trying to move to the next waypoint although the loading screen is still shown.

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

Re: CPawn error occasionally during load screen.

#9 Post by rock5 » Fri Feb 25, 2011 10:17 am

JackBlonder wrote:I think it's trying to move to the next waypoint although the loading screen is still shown.
So you are suggesting waitForLoadingScreen() is failing to wait until the loading screen is completely gone? I can't see how that can happen. It will only exit the function when the loading screen address is equal to '0'. For it to exit early it would have to read '0' when it's actually still '1'. Maybe the game is buggy when the system is stressed and changes the address to '0' before it finishes loading? Seems unlikely though.

Maybe it just needs a pause.

Can you guys maybe try adding a yrest after using the waitForLoadingScreen() function and see if that helps. Just a few seconds should do it.
  • 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

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: CPawn error occasionally during load screen.

#10 Post by Alkaiser » Fri Feb 25, 2011 6:18 pm

On the topic of waitForLoadingScreen()...

I have an SSD so my load times are usually extremely short. The problem is that sometimes there is no loading screen at all and waitForLoadingScreen() will never complete. I have a Cyclops Lair farm script and it happens often when entering the Lair after a few runs. I've had to use yrest instead. How about something like this: waitForLoadingScreen(5) - if after 5 seconds we are still waiting for load screen, assume we have already loaded.

I haven't noticed any crashes related to waitForLoadingScreen().

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

Re: CPawn error occasionally during load screen.

#11 Post by rock5 » Fri Feb 25, 2011 7:20 pm

Alkaiser wrote:On the topic of waitForLoadingScreen()...

I have an SSD so my load times are usually extremely short. The problem is that sometimes there is no loading screen at all and waitForLoadingScreen() will never complete. I have a Cyclops Lair farm script and it happens often when entering the Lair after a few runs. I've had to use yrest instead. How about something like this: waitForLoadingScreen(5) - if after 5 seconds we are still waiting for load screen, assume we have already loaded.

I haven't noticed any crashes related to waitForLoadingScreen().
Wow, no loading screen at all? That's mind blowing.

Your idea wouldn't really work. The way the function works is, first it waits for the loading screen to appear, then it waits for it to disappear. The time it takes to appear will be different in different situations, eg. when changing character the character will wait 30s before logging off then change character then finally show the loading screen. So 5s wouldn't be long enough. I guess it could do with a general timeout but usually it wouldn't make sense to continue the script it if failed to teleport as you would be in the wrong area for the rest of the script.

I think yours is a special case so if yrest(5) work, just use that.
  • 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

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: CPawn error occasionally during load screen.

#12 Post by Alkaiser » Fri Feb 25, 2011 7:38 pm

I was thinking something along the lines of:

Code: Select all

function waitForLoadingScreen()
	-- wait for loading screen to appear - OR WAIT FOR A SPECIFIED TIME
	if memoryReadBytePtr(getProc(), addresses.loadingScreenPtr, addresses.loadingScreen_offset) == 0 then
		repeat
			yrest(1000)
		until memoryReadBytePtr(getProc(), addresses.loadingScreenPtr, addresses.loadingScreen_offset) == 1 or time_elapsed > 5 seconds
	end

	-- wait until loading screen is gone
	repeat
		yrest(1000)
	until memoryReadBytePtr(getProc(),addresses.loadingScreenPtr, addresses.loadingScreen_offset) == 0
	player:update()
end
After looking closer (if I'm understanding it right), I see that it is possible for this function to miss the load screen if it appears for less than 1 second. Maybe lowering the yrest value in the first loop would help?

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

Re: CPawn error occasionally during load screen.

#13 Post by rock5 » Fri Feb 25, 2011 8:40 pm

Alkaiser wrote: After looking closer (if I'm understanding it right), I see that it is possible for this function to miss the load screen if it appears for less than 1 second. Maybe lowering the yrest value in the first loop would help?
That's correct. Try a smaller value and see if it helps. If it does, I don't have a problem committing it.
  • 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

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: CPawn error occasionally during load screen.

#14 Post by Alkaiser » Sat Feb 26, 2011 12:04 am

rock5 wrote:
Alkaiser wrote: After looking closer (if I'm understanding it right), I see that it is possible for this function to miss the load screen if it appears for less than 1 second. Maybe lowering the yrest value in the first loop would help?
That's correct. Try a smaller value and see if it helps. If it does, I don't have a problem committing it.
I've set the first loop to yrest(100). So far so good. I'll keep it running all night and see what happens.

EDIT:
It's been running for over 14 hours now and it hasn't gotten stuck even once. I'd say it fixed my problem.

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: CPawn error occasionally during load screen.

#15 Post by JackBlonder » Mon Feb 28, 2011 1:57 pm

I tested the waitForLoadingScreen() with my netbook (low CPU power ) and the "Error reading memory in CPawn:update()" appears while the loading screen is still shown. I even added a yrest(15000) after waitForLoadingScreen() but it didn't help.
I then added a printf("")

Code: Select all

        waitForLoadingScreen();
        printf("Wait another 15 seconds\n");
        yrest(15000);
which is not reached when the error appears.
So the error has to happen during waitForLoadingScreen.
I think the memory pointer is switched when the blue bar reaches the right side and rombot tries to update player data player data is not readable when the loading screen is still there

[Edit]
After adding yrest(2000) before player:update() in waitForLoadingScreen() the error does not appear any more.

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

Re: CPawn error occasionally during load screen.

#16 Post by rock5 » Mon Feb 28, 2011 7:50 pm

JackBlonder wrote:[Edit]
After adding yrest(2000) before player:update() in waitForLoadingScreen() the error does not appear any more.
I'll add it to my next commit.
  • 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: No registered users and 1 guest