Andor Trainig Range

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
dejfit
Posts: 23
Joined: Wed Oct 05, 2011 6:25 am

Re: Andor Trainig Range

#41 Post by dejfit » Sat Nov 10, 2012 6:54 am

OK, here is what i made. It works great. Most of it is Lisa's code and rock's AT code. I want to make it log next char soon...

Code: Select all

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


	--=== User Options ===--


	When_Finished = "end"
		-- "end" to end script, "relog" to log next character, "charlist" to log next in 'charlist' and "waypointfilename" to load that waypointfile.

	CharList = {
	}
		-- Character list to use when using the "charlist" option above. Requires my "userfunction_LoginNextChar" userfunction.
		-- Find it here. http://www.solarstrike.net/phpBB3/viewtopic.php?p=10350
		--		eg.
		--		CharList = {
		--			{account=4,chars={}},
		--			{account=8,chars={1}},
		--			{account=7,chars={1,2,5}},
		--		}

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


	local kate = GetIdName(121035)  --Kate Wesker
	local magelly = GetIdName(120687)  --Magelly Basac
	

	
	
	--== MINIGAME ==--
	repeat
		player:update()
		if getZoneId() ~= 355 then
			
			local empties = inventory:itemTotalCount(0)
			if 5 > empties then
				-- Wait for user to make some space in inventory.
				cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
				player:sleep()
			end
			if 30 > inventory:itemTotalCount(203038) then
				print("Not enough Phirius Token Coins.")
				logentry = "Not enough Phirius Token Coins."
			--	checkRelog()
				return
			end

			if player:target_NPC(kate) then
				sendMacro("ChoiceOption(1);");
				yrest(1000);
				waitForLoadingScreen(10)
				if getZoneId() ~= 360 then
				print("Failed to teleport into Ancient Treasure. Maybe you already done it today.")
				logentry = "Failed to teleport into Ancient Treasure. Maybe you already done it today."
				end
			--	checkRelog()
			end


			if player:target_NPC(magelly) then
				yrest(2000);
				sendMacro("ChoiceOption(2);");   --Make it 1 if you want Timed arena
				yrest(2000);
				sendMacro("ChoiceOption(1);");
				yrest(2000);
				sendMacro("ChoiceOption(1);");
				yrest(12000);
				--	checkRelog()
				--	return

			end
		end


		
		repeat
            yrest(100)
         until  player:findNearestNameOrId(106881)
         print("OK event has started")
         repeat
            tort()
            player:update()
            buffed = player:getBuff(622402)
            yrest(100)
         until buffed.Level >= 2800 or not player:hasBuff(622402)
         print("Event finished, end score was "..buffed.Level)
		 error("Ending script")
		

	 
	until false
	
	
</onLoad>
</waypoints>

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

Re: Andor Trainig Range

#42 Post by lisa » Sat Nov 10, 2012 7:04 am

looks like it should work,
I would suguest having the tort() function in that WP as opposed to a userfunction =)

At this stage don't be to worried about log next char, it will probably error once the evnt has ended anyway because of this bit

Code: Select all

         until buffed.Level >= 2800 or not player:hasBuff(622402)
Basically if it doesn't get to the 2800 score then it will error from the hasBuff as that isn't the ideal implementation but it was what I came up with in the few minutes I had to write the code for it.
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

xrozhija
Posts: 51
Joined: Sat Apr 25, 2009 2:08 am

Re: Andor Trainig Range

#43 Post by xrozhija » Sun Nov 11, 2012 2:37 am

I don't quite get it, when i use the userfunction, it just stands there, not clicking any of the tortoises, it does write in the mm window with the list of all the mobs that are present, but doesnt click any of them to kill them.

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Andor Trainig Range

#44 Post by grande » Sun Nov 11, 2012 8:39 am

Thx again Lisa. This post contains a common but random error that occurs and how I'm using your code.

The error is a random crash usually midway through the event. Just seems like the same crap from siege war... who knows. Here's the output:

Code: Select all

resting a little before attacking, countdown starts now.
12
11
...
2
1
targeting: 106882
targeting: 106881
Did not find any crashed game clients.
8:28am - X:/micromacro/scripts/rom/functions.lua:674: bad argument #1 to 'memory
ReadByte' ((null))
I do the userfunction method since that's sort of how Lisa's code evolved. Then, I call it from the waypoint with part of something from the function... errr yeah:

Userfunction:

Code: Select all

         function tort()
            local proc = getProc()
            
            local function checkclicked(address)
               local tmp = memoryReadRepeat("int", proc, address + addresses.pawnAttackable_offset) or 0;
               if bitAnd(tmp,0x8) then
                  return true
               else
                  return false
               end
            end

            local function one(ID)
               print("targeting: "..ID)
               local objectList = CObjectList();
               objectList:update();
               local objSize = objectList:size()
               for i = 0,objSize do 
                  obj = objectList:getObject(i)

                  if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
                     player:target(obj)
                     RoMScript("UseExtraAction(1)")
                     yrest(10)
                     player:target(obj)
                     RoMScript("UseExtraAction(1)")
                     if ID == 106883 then
                        yrest(10)
                        player:target(obj)
                        RoMScript("UseExtraAction(1)")   
                     end
                     yrest(100)
                  end
               end
            end
            if player:findNearestNameOrId(106881) then
               local countt = 12
               print("resting a little before attacking, countdown starts now.")
               repeat
                  print(countt)
                  yrest(1000)
                  countt = countt -1
               until countt == 0
               for i = 1,6 do
                  one(106882)
                  one(106882)
                  one(106881)
                  one(106883)
                  one(106884)   
               end
            end
         end
And the waypoint:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
   --== User Option ==--
      startGMDetect()
              

</onload>
<!-- #  1 --><waypoint x="4935" z="-1936" y="109">		
		player:target_NPC("Kate Wesker");
		yrest(1000);
		sendMacro("ChoiceOption(1);");
		waitForLoadingScreen();
		player:target_NPC("Magelly Basac");
		yrest(1000);
		sendMacro("ChoiceOption(1);");
		yrest(1000);
		sendMacro("ChoiceOption(1);");
		yrest(1000);
		sendMacro("ChoiceOption(1);");
		yrest(14000);
</waypoint>
<!-- #  2 --><waypoint x="53" z="411" y="963">
         repeat
            tort()
            player:update()
            buffed = player:getBuff(622402)
            yrest(100)
         until buffed.Level >= 2000 or not player:hasBuff(622402)
         print("Event finished, end score was "..buffed.Level)
</waypoint>
<!-- #  6 --><waypoint x="-48" z="337" y="961">		
		player:target_NPC("Magelly Basac");
		sendMacro("ChoiceOption(1);");
		sendMacro("ClickRequestDialogButton(0)");
		waitForLoadingScreen();
</waypoint>
<!-- #  1 --><waypoint x="4935" z="-1936" y="109">		
		loadPaths("survivalR5");
</waypoint>
</waypoints>

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

Re: Andor Trainig Range

#45 Post by lisa » Sun Nov 11, 2012 9:32 am

give this a try.

Basically all I did was in the romscript function, which is done quite a bit, I added

Code: Select all

local proc = getProc()
at the start of the function and then used the proc instead of getProc()

What this does is reduce the number of times the getProc() function is called, from 4 down to 1.

It might help.
Attachments
functions.lua
(62.84 KiB) Downloaded 256 times
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

dejfit
Posts: 23
Joined: Wed Oct 05, 2011 6:25 am

Re: Andor Trainig Range

#46 Post by dejfit » Sun Nov 11, 2012 10:20 am

Lisa, do you know why sometimes bot stops after clearing first wave with this error:

Code: Select all

...\rom/bot.lua:505: onLoad error: [string "..."]:86: attempt to index global 'buffed' (a boolean value)
?

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

Re: Andor Trainig Range

#47 Post by lisa » Sun Nov 11, 2012 10:28 am

lisa wrote:it will error from the hasBuff as that isn't the ideal implementation but it was what I came up with in the few minutes I had to write the code for it.
it should actually be getBuff and not hasBuff

Code: Select all

buffed = player:getBuff(622402)
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

dejfit
Posts: 23
Joined: Wed Oct 05, 2011 6:25 am

Re: Andor Trainig Range

#48 Post by dejfit » Sun Nov 11, 2012 10:34 am

My code looks lik this:

Code: Select all

repeat
            tort()
            player:update()
            buffed = player:getBuff(622402)
            yrest(100)
         until not RoMScript("TimeKeeperFrame:IsVisible()") or buffed.Level >= 3400
and sometimes i get this error. How to make it better?

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

Re: Andor Trainig Range

#49 Post by lisa » Sun Nov 11, 2012 10:53 am

try

Code: Select all

repeat
            tort()
            player:update()
            buffed = player:getBuff(622402)
            yrest(100)
until (not RoMScript("TimeKeeperFrame:IsVisible()")) or (buffed and buffed.Level >= 3400)
if rombot can't find the buff it returns it as false, so buffed would be false
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

wulf
Posts: 22
Joined: Sat Sep 01, 2012 5:43 am

Re: Andor Trainig Range

#50 Post by wulf » Sun Nov 11, 2012 5:07 pm

lisa wrote:This is what I was using
I have 50% of crashes with this script:

Code: Select all

Command> tort()
resting a little before attacking, countdown starts now.
12
11
10
9
8
7
6
5
4
3
2
1
targeting: 106882
targeting: 106882
targeting: 106881
onLoad error: ...tten 4.0.9.2504/micromacro/scripts/rom/functions.lua:674: bad argument #1 to 'memoryReadByte' ((null))
EDIT: ignore this, I see it has been reported previously.

EDIT2: now (with the new function.lua) I have:

Code: Select all

Command> tort()
resting a little before attacking, countdown starts now.
12
11
10
9
8
7
6
5
4
3
2
1
targeting: 106882
targeting: 106882
targeting: 106881
onLoad error: ... botten 4.0.9.2504/micromacro/scripts/rom/macros.lua:162: bad argument #1 to 'memoryReadUInt' ((null))

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

Re: Andor Trainig Range

#51 Post by lisa » Sun Nov 11, 2012 8:01 pm

wulf wrote:EDIT2: now (with the new function.lua) I have:
Is the game crashing before the print or is MM just doing the error without the game crashing.
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

wilifox
Posts: 86
Joined: Tue Jul 26, 2011 6:00 pm

Re: Andor Trainig Range

#52 Post by wilifox » Mon Nov 12, 2012 3:42 am

Code: Select all

 ...\rom/bot.lua:505: onLoad error: [string "..."]:86: attempt to index global 'buffed' (a boolean value)? 
Why this error?? Thx you!!

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

Re: Andor Trainig Range

#53 Post by lisa » Mon Nov 12, 2012 3:47 am

wilifox wrote:

Code: Select all

 ...\rom/bot.lua:505: onLoad error: [string "..."]:86: attempt to index global 'buffed' (a boolean value)? 
Why this error?? Thx you!!
Hmm you can either click this link
http://www.solarstrike.net/phpBB3/viewt ... 916#p43916

OR just read a few posts before this 1........
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

wulf
Posts: 22
Joined: Sat Sep 01, 2012 5:43 am

Re: Andor Trainig Range

#54 Post by wulf » Mon Nov 12, 2012 6:34 am

lisa wrote:Is the game crashing before the print
yes

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

Re: Andor Trainig Range

#55 Post by lisa » Mon Nov 12, 2012 8:16 am

wulf wrote:
lisa wrote:Is the game crashing before the print
yes
try doubling the values in the yrest()

Maybe you just need more time between targeting the next "mob"
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

wilifox
Posts: 86
Joined: Tue Jul 26, 2011 6:00 pm

Re: Andor Trainig Range

#56 Post by wilifox » Mon Nov 12, 2012 12:46 pm

where put in the code the checkRelog() function??? not found in my code ;((

thx you

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
function checkRelog()
  SetCharList({
   {account=1 , chars= {2,3,4,5,7,8}},
   {account=2 , chars= {1,2,3,4,5,6,7,8}},
   {account=6 , chars= {1,2,3,4,5,6,7,8}},
   {account=7 , chars= {1,2,3,4,5,6,7,8}},

   })
      LoginNextChar()
      loadProfile()
      loadPaths("Eventos/tortugas.xml");
end

   --=== User Options ===--

   local kate = GetIdName(121035)  --Kate Wesker
   local magelly = GetIdName(120687)  --Magelly Basac
   
function tort()
            local proc = getProc()
            
            local function checkclicked(address)
               local tmp = memoryReadRepeat("int", proc, address + addresses.pawnAttackable_offset) or 0;
               if bitAnd(tmp,0x8) then
                  return true
               else
                  return false
               end
            end

            local function one(ID)
               print("targeting: "..ID)
               local objectList = CObjectList();
               objectList:update();
               local objSize = objectList:size()
               for i = 0,objSize do 
                  obj = objectList:getObject(i)

                  if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
                     player:target(obj)
                     RoMScript("UseExtraAction(1)")
                     yrest(10)
                     player:target(obj)
                     RoMScript("UseExtraAction(1)")
                     if ID == 106883 then
                        yrest(10)
                        player:target(obj)
                        RoMScript("UseExtraAction(1)")   
                     end
                     yrest(100)
                  end
               end
            end
            if player:findNearestNameOrId(106881) then
               local countt = 12
               print("resting a little before attacking, countdown starts now.")
               repeat
                  print(countt)
                  yrest(1000)
                  countt = countt -1
               until countt == 0
               for i = 1,6 do
                  one(106882)
                  one(106882)
                  one(106881)
                  one(106883)
                  one(106884)   
               end
            end
         end

   
   
   --== MINIGAME ==--
   repeat
      player:update()
      if getZoneId() ~= 355 then
         
         local empties = inventory:itemTotalCount(0)
         if 5 > empties then
            -- Wait for user to make some space in inventory.
            cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
            player:sleep()
         end
         if 30 > inventory:itemTotalCount(203038) then
            print("Not enough Phirius Token Coins.")
            logentry = "Not enough Phirius Token Coins."
            
            
         end

         if player:target_NPC(kate) then
            sendMacro("ChoiceOption(1);");
            yrest(1000);
            waitForLoadingScreen(10)
            if getZoneId() ~= 360 then
            print("Failed to teleport into Ancient Treasure. Maybe you already done it today.")
            logentry = "Failed to teleport into Ancient Treasure. Maybe you already done it today."
            end
         
         end


         if player:target_NPC(magelly) then
            yrest(2000);
            sendMacro("ChoiceOption(2);");   --Make it 1 if you want Timed arena
            yrest(2000);
            sendMacro("ChoiceOption(1);");
            yrest(2000);
            sendMacro("ChoiceOption(1);");
            yrest(12000);
         

         end
      end


      
      repeat
            yrest(100)
         until  player:findNearestNameOrId(106881)
         print("OK event has started")
                 
 
            repeat
            tort()
            player:update()
            buffed = player:getBuff(622402)
            yrest(100)
            until buffed.Level >= 2800 or not player:hasBuff(622402)

         
	
	 
	
      

    
   until false
   
	 -- player:target_NPC(magelly)
	 -- sendMacro("ChoiceOption(1);");
         -- yrest(2000);
	 -- RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
	 
	checkRelog()
   
</onLoad>
</waypoints>

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Andor Trainig Range

#57 Post by Cindy » Mon Nov 12, 2012 6:06 pm

Game crashing every time now, at "targeting: 106881", MM window stops without any apparent sign (other than things arent moving in it)

dr-nuker
Posts: 145
Joined: Sun Oct 09, 2011 7:33 am

Re: Andor Trainig Range

#58 Post by dr-nuker » Mon Nov 12, 2012 6:49 pm

Cindy wrote:Game crashing every time now, at "targeting: 106881", MM window stops without any apparent sign (other than things arent moving in it)
Somehow i have tha same now. When it comes to shootin the mewts the game crashes without report (mostly).

So sad that this was working very nice and now fails :/

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Andor Trainig Range

#59 Post by Cindy » Mon Nov 12, 2012 6:57 pm

Update: the crashed window has a red message "Already casting" I wonder if that is related?

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Andor Trainig Range

#60 Post by Cindy » Mon Nov 12, 2012 8:32 pm

yrest(250) didnt work... and im out of test characters

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests