userfunction_BattleGround

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

userfunction_BattleGround

#1 Post by kenzu38 » Tue Nov 10, 2015 6:07 pm

Ok, so here's a userfunction for queueing for battlegrounds. It also has some other functions related to battlegrounds. I'll probably add some more later when I find some other useful stuff. Only worked on this quickly so I haven't really had time to think things through.

EDIT: Oh and btw, if you're using this for Arcanium Arena, some bot files will have to be modified or you will get a player.class1 error because duelists aren't listed as a class. you'll have to add the class to your pawn.lua and add it to settings.lua. I'll just post a tutorial in the next post to not clutter the OP.

List of valid arguments for use in most of the functions in this userfunction or simply (bgcode list):

Code: Select all

1 vs 1 Arena = "1v1"	
Windrunner Race = "wr"
3 vs 3 Arena = "3v3"
6 vs 6 Arena = "6v6"
Karros Canyon = "kc"
Visdun Fortress = "vf"
Tyrefen Mountain Range = "tmr"
Arcanium Arena = "aa"


Syntax:

[color=#0000FF][size=150]joinBG(bgcode, waittime)[/size][/color] 

-- this function queues for a battleground that you specify. It waits for the BG queue popup and accepts it when it appears. It then uses waitForLoadingScreen(), so waittime determines the argument for said function.

Examples:
joinBG("aa", 60)    -- joins Arcanium arena, max wait time for loading screen is 60 seconds
joinBG("1v1")        -- joins 1 vs 1 arena, waits indefinitely for loading screen

[color=#0000FF][size=150]quitBG(bgcode)[/size][/color]

-- this function cancels queues for a battleground that you specify. If you don't put any argument, it will cancel all battleground queues.

Examples:
quitBG("6v6")     -- cancels the queue for 6 vs 6 arena.
quitBG()      -- cancels all queues

[color=#0000FF][size=150]inBG(bgcode)[/size][/color]

-- this function uses getZoneId() to check the zone you're in, if it matches the bgcode argument, then it returns true, otherwise it returns false.

Example:
[code]if inBG("tmr") then
          print("Char is in TMR.")
else
          print("Char is not in TMR.")
end
leaveBG(waittime)

-- this function lets the char leave the battleground. Like joinBG(), waittime is the argument for waitForLoadingScreen().

Example:
leaveBG(30) -- leaves battleground and waits for the loading screen for 30 seconds.

BGqtime(bgcode)

-- this function returns how many minutes you have been queued for the specified BG (bgcode). If it returns 0, then it means you're not queued.

Example:

Code: Select all

if BGqtime("kc") == 0 then   -- not queued
          print("Not queued for Karros Canyon")
else
          print("You've been in queue for %s minutes.", BGqtime("kc"))
end
BGPopup(arg)

-- if arg is "ok", it will accept a BG queue popup, anything other than "ok" will return true or false, true if a BG queue popup is visible and false if there isn't one.

Example:

Code: Select all

if BGPopup() then   -- no argument
	BGPopup("ok")	  -- accept BG queue popup
else
	print("No BG Queue Popup detected.")          
end
Attachments
userfunction_BattleGround.lua
v1.1
- added 2 new functions
- fixed joinBG code to always check if you got kicked out of queue
- fixed joinBG code for windrunner race. Now detects and accepts the extra popup to pay for a race ticket.
(3.75 KiB) Downloaded 534 times
Last edited by kenzu38 on Thu Nov 12, 2015 5:47 pm, edited 3 times in total.

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: userfunction_BattleGround

#2 Post by kenzu38 » Tue Nov 10, 2015 6:48 pm

Ok, so to prevent the bot to throw an error, you will have to edit pawn.lua and settings.lua. Frankly, I'm not sure if they're the only ones you need to edit but so far I didn't get errors in the short time that I was testing the userfunction.

You probably also have to edit your profiles.

Either way, you can just post here or in the runes of magic section so the mods can help you out.

So anyway, let's start with pawn.lua in your scripts/RoM/classes folder. Open it and you will see a cluster:

Code: Select all

CLASS_NONE = -1;
CLASS_WARRIOR = 1;
CLASS_SCOUT = 2;
CLASS_ROGUE = 3;
CLASS_MAGE = 4;
CLASS_PRIEST = 5;
CLASS_KNIGHT = 6;
CLASS_WARDEN = 7;
CLASS_DRUID = 8;
CLASS_WARLOCK = 9;
CLASS_CHAMPION = 10;
Just add this line immediately after CLASS_CHAMPION:

Code: Select all

CLASS_DUELIST = 11;
Next we edit settings.lua in RoM folder, easiest way to find the cluster of codes to add to is by using the find function of your editor (notepad, notepad++ etc.):

Search for the string "undefined" without quotes.

You should see these lines just a few lines above:

Code: Select all

if( settings.profile.options.COMBAT_TYPE ~= "ranged" and
	    settings.profile.options.COMBAT_TYPE ~= "melee" ) then
		if( player.Class1 == CLASS_WARRIOR or
		    player.Class1 == CLASS_ROGUE   or
		    player.Class1 == CLASS_WARDEN  or
		    player.Class1 == CLASS_KNIGHT  or
Just add:

Code: Select all

player.Class1 == CLASS_DUELIST  or
after the line player.Class1 == CLASS_KNIGHT or and save the file.

That's it.

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: userfunction_BattleGround

#3 Post by noobbotter » Wed Nov 11, 2015 1:07 pm

So far, so good with your userfunctions Kenzu38. So I wrote up a waypoint file to take advantage of these userfunctions. This waypoint will join the arcanium arena, and once over, it will leave, and then rejoin. It will keep going until you stop it. Also, if you manually join the arena, you can still run this waypoint and it will see that you're already inside and will pickup from there appropriately.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
local myvar = true
local arenaends = "The battle is over."
local mytime = os.time()
repeat
	if not inBG("aa") then
		joinBG("aa")
	end
	mytime = os.time()
	
	EventMonitorStart("Sysmsg", "SYSTEM_MESSAGE")
	repeat
		local totaltime = (os.time()-mytime)
		local timemeasure = "seconds"
		if totaltime >= 60 then
			timemeasure = "minutes"
			totaltime = (os.time()-mytime)/60
			cprintf(cli.yellow,"\rBeen in arena for %0.1f minutes.",totaltime)
		else
			cprintf(cli.yellow,"\rBeen in arena for %0.1f seconds.",totaltime)
		end
		
		local time, _, msg = EventMonitorCheck("Sysmsg", "1")
		yrest(5000)
	until msg and msg:find(arenaends)
	leaveBG(30)
	yrest(500)
	
until not myvar
</onload>
</waypoints>

little_Fan
Posts: 12
Joined: Tue Jun 09, 2015 8:30 am

Re: userfunction_BattleGround

#4 Post by little_Fan » Thu Nov 12, 2015 7:10 am

hey there,
I´ve tested your waypoint and it works! for just one time :D
when I leave the arcanium-arena (after 2 minutes waiting) it wont enter the arena again.
how can I loop the waypoint and how can I leave the arena without waiting for 2 minutes?
thx for hlp ;)

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: userfunction_BattleGround

#5 Post by noobbotter » Thu Nov 12, 2015 8:15 am

I don't know why it's not working. For me, as soon as it gets the message that the game is over, it leaves the arena and rejoins the queue again, and then continues looping. I'm not sure what is preventing it from working for others. Can anyone see anything in the waypoint that would prevent it from working for some people?

famousk
Posts: 10
Joined: Sat Jun 07, 2014 9:20 am

Re: userfunction_BattleGround

#6 Post by famousk » Thu Nov 12, 2015 8:42 am

yes it works perfectly for the first round for me then it just doesn't loop. its like it doesn't see then battle is over message so it keeps counting up as if you are still in the arena.

little_Fan
Posts: 12
Joined: Tue Jun 09, 2015 8:30 am

Re: userfunction_BattleGround

#7 Post by little_Fan » Thu Nov 12, 2015 9:45 am

Just get the arcaniumspam.xml from kenzu38 in this post http://www.solarstrike.net/phpBB3/viewt ... =21&t=6212
That works properly ;)
At least i have a bigger problem: if there is no action in the arena, everyone gets dropped and you are back on the loginscreen :(
Is there any possibility to use rock5´s fastlogin or other logins to log back in and start looping the arena again?

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: userfunction_BattleGround

#8 Post by kenzu38 » Thu Nov 12, 2015 6:12 pm

I'm guessing you guys are not using an english client that's why what noobbotter posted doesn't work for you.

Anyway, I polished the userfunction and uploaded a new version. It's recommended that you guys download the latest version as I only found out today that you could get kicked out of queue. The earlier code didn't account for that and would leave the chars standing doing nothing the whole time.

And btw, I didn't post the waypoint arcaniumspam in the userfunctions section before since I wasn't really sure how to properly bot Arcanium. I thought you get fewer rewards if you were just AFK the whole time, but I know now it's the same even if you do plenty inside. If you're on the losing team, you get 20 and 50 if you're on the winning team. So I went ahead and added a bit more functionality to that waypoint. Just go here to download the waypoint.

famousk
Posts: 10
Joined: Sat Jun 07, 2014 9:20 am

Re: userfunction_BattleGround

#9 Post by famousk » Thu Nov 12, 2015 6:44 pm

kenzu38 wrote:I'm guessing you guys are not using an english client that's why what noobbotter posted doesn't work for you.

Anyway, I polished the userfunction and uploaded a new version. It's recommended that you guys download the latest version as I only found out today that you could get kicked out of queue. The earlier code didn't account for that and would leave the chars standing doing nothing the whole time.

And btw, I didn't post the waypoint arcaniumspam in the userfunctions section before since I wasn't really sure how to properly bot Arcanium. I thought you get fewer rewards if you were just AFK the whole time, but I know now it's the same even if you do plenty inside. If you're on the losing team, you get 20 and 50 if you're on the winning team. So I went ahead and added a bit more functionality to that waypoint. Just go here to download the waypoint.
I am using the english client, it must be something wrong on my end though since it's working for everyone else

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: userfunction_BattleGround

#10 Post by noobbotter » Fri Nov 13, 2015 8:57 am

I'm not sure what else would prevent you guys from working properly. Have you ever used event monitoring in other waypoints successfully? Maybe my yrest position and time was too much for some of your clients causing it to miss the event. I reduced the yrest time and moved it's location. Try this one and see if you have any better luck with it. Also, Make sure you've edited the other files that are mentioned in the first post on this topic.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
local myvar = true
local arenaends = "The battle is over."
local mytime = os.time()
repeat
	if not inBG("aa") then
		joinBG("aa")
	end
	mytime = os.time()
	
	EventMonitorStart("Sysmsg", "SYSTEM_MESSAGE")
	repeat
		yrest(1000)
		local totaltime = (os.time()-mytime)
		local timemeasure = "seconds"
		if totaltime >= 60 then
			timemeasure = "minutes"
			totaltime = (os.time()-mytime)/60
			cprintf(cli.yellow,"\rBeen in arena for %0.1f minutes.",totaltime)
		else
			cprintf(cli.yellow,"\rBeen in arena for %0.1f seconds.",totaltime)
		end
		
		local time, _, msg = EventMonitorCheck("Sysmsg", "1")
	until msg and msg:find(arenaends)
	leaveBG(30)
	yrest(500)
	
until not myvar
</onload>
</waypoints>

Technicolor
Posts: 1
Joined: Wed Oct 07, 2015 4:57 pm

Re: userfunction_BattleGround

#11 Post by Technicolor » Fri Nov 13, 2015 2:46 pm

Had the same error as the people before, but this new version seems to solve it. Running well now, thanks.

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: userfunction_BattleGround

#12 Post by noobbotter » Fri Nov 13, 2015 3:27 pm

Glad to hear it. I just finished some other modifications. This one will give you an update of how many Badges of the Warrior you started with, how many you earn each time the round is over, total earned during the script running, and it will also stop running when it reaches max number of badges, which I think is 2000.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
local initialbadges, spaceleft = getCurrency("warrior")
print("Starting script with "..initialbadges.." Badges of the warrior.")
local myvar = true
local arenaends = getTEXT("BG_AA_END")
local mytime = os.time()

repeat
	local curbadges, spaceleft = getCurrency("warrior")
	if spaceleft == 0 then
		error("We have reached the maximum number of badges. Spend some before continuing.")
	end
	print("We now have "..curbadges.." badges of the warrior. We have gained "..curbadges-initialbadges.." since starting this script.\n")
	if not inBG("aa") then
		joinBG("aa")
	end
	mytime = os.time()
	
	EventMonitorStart("Sysmsg", "SYSTEM_MESSAGE")
	repeat
		yrest(1000)
		local totaltime = (os.time()-mytime)
		local timemeasure = "seconds"
		if totaltime >= 60 then
			timemeasure = "minutes"
			totaltime = (os.time()-mytime)/60
			cprintf(cli.yellow,"\rBeen in arena for %0.1f minutes.",totaltime)
		else
			cprintf(cli.yellow,"\rBeen in arena for %0.1f seconds.",totaltime)
		end
		
		local time, _, msg = EventMonitorCheck("Sysmsg", "1")
	until msg and msg:find(arenaends)
	EventMonitorStop("Sysmsg")
	leaveBG(30)
	player:update()
	local endroundbadges, spaceleft = getCurrency("warrior")
	print("Earned "..endroundbadges-curbadges.." badges this round.\n")
	yrest(500)
until not myvar
</onload>
</waypoints>

User avatar
sauhard
Posts: 130
Joined: Wed Mar 05, 2014 10:30 am

Re: userfunction_BattleGround

#13 Post by sauhard » Wed Nov 25, 2015 4:44 am

so how many badges we get just for joining, waiting and leaving?
Satisfaction is the end of desire!!

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: userfunction_BattleGround

#14 Post by noobbotter » Wed Nov 25, 2015 3:19 pm

At a minimum, you will win 20 badges. If your team happens to win, you will receive 50 badges. for the rewards, you can get a cape for 600 badges and it will come with either 1 or 2 stats on it, but both stats will be Arcanium stats. With these, there are a lot more crap stats, but My very first pull consisted of a Dex/PA and my second pull had an HP/PA stat on it. other nice thing is that even though a lot of the pulls might be crap, it's real easy to use 3 puris to end up with 6 stats that you can put on alt gear to easily give your alts any boosts they may need to help them survive tougher areas.

Hidden
Posts: 101
Joined: Tue May 08, 2012 6:10 pm

Re: userfunction_BattleGround

#15 Post by Hidden » Thu Mar 10, 2016 1:01 pm

2016-03-11 04:16:14 - .../scripts/rom/userfunctions/userfunction_BattleGround.lua :63: bad argument #1 to 'pairs' (table expected, got string)

Line 63 is this:

Code: Select all

for k,v in pairs(RoMScript("BATTLE_GROUND_COLUMN_LIST")) do
		if v == bgtoenter then
			indexnum = k
			break
		end
Just fiddling around with ROM again amazing how much I have forgotten

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: userfunction_BattleGround

#16 Post by kenzu38 » Fri May 06, 2016 7:15 am

Hidden wrote:2016-03-11 04:16:14 - .../scripts/rom/userfunctions/userfunction_BattleGround.lua :63: bad argument #1 to 'pairs' (table expected, got string)

Line 63 is this:

Code: Select all

for k,v in pairs(RoMScript("BATTLE_GROUND_COLUMN_LIST")) do
		if v == bgtoenter then
			indexnum = k
			break
		end
Just fiddling around with ROM again amazing how much I have forgotten
Only cause I can think of is you're playing on a server that uses a different variable name for BATTLE_GROUND_COLUMN_LIST.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest