Error Script

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Error Script

#1 Post by Lamkefyned » Sat Sep 06, 2014 8:23 pm

I made this script that took me to midnight and now I get an error from time to time in different parts of the script can you help?

ERROR:
Sin título.jpg

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<waypoints>

	<onLoad>
			--== User Option ==--
			
		local RunningSpeed 	= 59
		local MaxHonor 		= 25000
		local NPCID 		= 115407
		local StoreOption 	= 3
		local ObjectBuy 	= 242263
		local AmountBuy 	= 555
		local LimitGold 	= 1000000

--=================--

	function check()
		EventMonitorStart("CHECK","CHAT_MSG_SYSTEM")
		repeat
			yrest(100)
			 local time, moreToCome, msg = EventMonitorCheck("CHECK", "1")
		 until msg and string.find(msg,"10")
		EventMonitorStop("CHECK")
		yrest(25000)
	end

--=================--
	  
	function StaticPopup()
		if RoMScript("StaticPopup1:IsVisible()") then
		sendMacro('StaticPopup_OnClick(StaticPopup1, 1);')
		end
	end

--=================--

	function clearScreenn()
		local _, _, x, y = getConsoleAttributes();
		for j = 1, y do
				printf(string.rep(' ', x));
		end
	  clearScreen();
	end

--=================--
	  
	local offsets = {addresses.charPtr_offset, addresses.pawnSwim_offset1, addresses.pawnSwim_offset2}
	local active = 4

	function flyDG()
		memoryWriteString(getProc(), addresses.swimAddress, string.rep(string.char(0x90),#addresses.swimAddressBytes));
		memoryWriteIntPtr(getProc(), addresses.staticbase_char, offsets, active);
	end

	function flyoffDG()
		memoryWriteString(getProc(), addresses.swimAddress, string.char(unpack(addresses.swimAddressBytes)));
	end

	local playerAddress = memoryReadIntPtr(getProc(), addresses.staticbase_char, addresses.charPtr_offset);
		if playerAddress ~= 0 then
		memoryWriteFloat(getProc(), playerAddress + 0x40, RunningSpeed);
	end

	unregisterTimer("timedSetWindowName");
	unregisterTimer("window")
	
	local function comma_value(n) 
		local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
		return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())
	end
	
	local _starttime = os.time()

		local startxp = getCurrency("honor")
		local function _window()
			local amount = getCurrency("honor")
			local _charname = string.sub(player.Name,1,7)
			local _timepassed = (os.time() - _starttime)/3600
			local _printtime = string.sub(_timepassed,1,4)
			local _xpreceived = amount - startxp
			local _xpperhour = string.sub((_xpreceived/_timepassed),1,8)				
			setWindowName(getHwnd(),sprintf(_charname.." Current Honor: "..comma_value(amount).." Honor per hour: "
			..comma_value(_xpperhour).." Time passed: ".._printtime))
		end
		registerTimer("window", secondsToTimer(30), _window);
		_window()

--=================--
	
	local CurrentGold = RoMScript('GetPlayerMoney("copper");')
	function CheckGold()
		if LimitGold >= CurrentGold then
			cprintf(cli.red,"\n  GOLD : %s \n  Gold limit established. \n\n", comma_value(CurrentGold))
			player:sleep()
			player:update()
		end
	end

--=================--

clearScreenn()
CheckGold()
		
--=================--
	  
	if getZoneId() == 6 then
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())
		travelTo("ObsidianCastle")
		player:target_NPC(111731)
		sendMacro("ChoiceOption(2);");
		waitForLoadingScreen(10)
	end

--=================--
	  
	if getZoneId() == 401 then
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())
		GotoGuild("Drill Ground")
		player:target_Object("Drill Ground");
		sendMacro("ChoiceOption(1);");
		waitForLoadingScreen(10)
	end
	  
--=================--
	  
	if getZoneId() == 354 then
		clearScreenn()
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())

		if MaxHonor > getCurrency("honor") then
		  repeat
			flyDG()
			player:moveTo(CWaypoint(5121,2515,13),true)
			player:moveTo(CWaypoint(5121,2651,111),true)
			player:moveTo(CWaypoint(4754,2954,430),true)
			player:moveTo(CWaypoint(2609,4302,430),true)
			player:moveTo(CWaypoint(2120,4644,13),true)
			player:moveTo(CWaypoint(2665,4160,430),true)
			player:moveTo(CWaypoint(3443,4016,430),true)
			check()
			cprintf(cli.lightgreen,"\n  TOTAL HONOR : %s \n\n", getCurrency("honor"))
		  until getCurrency("honor") == MaxHonor
		else
			clearScreenn()
			flyoffDG()
			player:target_NPC(112066)
			sendMacro("ChoiceOption(7);");
			waitForLoadingScreen(10)
				if LimitGold >= CurrentGold then
					cprintf(cli.red,"\n  GOLD : %s \n  Gold limit established. \n\n", comma_value(CurrentGold))
					GotoGuild("Guild Mailbox")
					UMM_TakeMail()
				end
			GotoGuild("Guild Castle Transport Point")
			player:moveTo(CWaypoint(80,-568,6),true)
			StaticPopup()
			waitForLoadingScreen(10)
		end
	end
	
--=================--
	
	if getZoneId() == 6 then
		travelTo("MercenarySquare")
	end

--=================--
	  
	if getZoneId() == 6 then
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())
		player:moveTo(CWaypoint(-22062,3654,-179),true)
		player:target_NPC(NPCID)
		yrest(500)
		if StoreOption == 1 then
			sendMacro("ChoiceOption(1);");
		elseif StoreOption == 2 then
			sendMacro("ChoiceOption(2);");
		elseif StoreOption == 3 then
			sendMacro("ChoiceOption(3);");
		end
		yrest(1000)
		store:buyItem(ObjectBuy, AmountBuy)
		yrest(500)
		RoMScript("CloseAllWindows()")	
		GuildDonate("all", "green")
		yrest(1000)
	end
	
--=================--
	  
	travelTo("ObsidianCastle")
	loadPaths(__WPL.FileName);
	
--=================--
	 
	</onLoad>
</waypoints>

If you think something is right just because everyone else believes,you're not thinking.

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

Re: Error Script

#2 Post by rock5 » Sat Sep 06, 2014 9:47 pm

For honor it gets the 'limit' from this command.

Code: Select all

		amount, limit = RoMScript("GetPlayerPointInfo("..group..","..index..",\"\")")
For limit to be nil the RoMScript would have to have failed. There are already steps in RoMScript to check and try again if it fails. For it to fail you may have some other issue such as pushing your system too hard or something interfering with the smooth running of your client, it's hard to say really.

If you want a quick fix try changing line 2687 of functions.lua

Code: Select all

		amount, limit = RoMScript("GetPlayerPointInfo("..group..","..index..",\"\")")
to

Code: Select all

		repeat
			amount, limit = RoMScript("GetPlayerPointInfo("..group..","..index..",\"\")")
		until amount and limit
  • 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
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Error Script

#3 Post by Lamkefyned » Sun Sep 07, 2014 7:34 pm

the problem is not solved and
If you think something is right just because everyone else believes,you're not thinking.

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

Re: Error Script

#4 Post by rock5 » Mon Sep 08, 2014 1:47 am

What does it do now? Does it freeze or do you still get the "limit is nil" error?
  • 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
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Error Script

#5 Post by Lamkefyned » Mon Sep 08, 2014 8:12 pm

if the errors have stopped with this code

Code: Select all

      repeat
         amount, limit = RoMScript("GetPlayerPointInfo("..group..","..index..",\"\")")
      until amount and limit
but I changed the entire script and if I remove this modification still giving error
If you think something is right just because everyone else believes,you're not thinking.

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

Re: Error Script

#6 Post by rock5 » Mon Sep 08, 2014 11:42 pm

Ok, if that fixes it I'll leave it in. It will be updated the next time I 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

User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Error Script

#7 Post by Lamkefyned » Tue Sep 09, 2014 5:21 am

Revision 779?¿
If you think something is right just because everyone else believes,you're not thinking.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests