scripts\rom/bot.lua:681: bad argument #1

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
abron1
Posts: 162
Joined: Wed Feb 22, 2012 12:43 am

scripts\rom/bot.lua:681: bad argument #1

#1 Post by abron1 » Thu Jan 31, 2013 2:25 pm

keep getting this error on my wd/s but my m/p is running the same waypoint.

11:18am - scripts\rom/bot.lua:681: bad argument #1 to 'lower' (string expected,
got boolean)

i tried to run them at the same time i get this error on the second character

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

Re: scripts\rom/bot.lua:681: bad argument #1

#2 Post by rock5 » Thu Jan 31, 2013 2:34 pm

You set RELOAD_AMMUNITION to "true" in your profile but it's supposed to be "false", "arrow" or "thrown".
  • 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

abron1
Posts: 162
Joined: Wed Feb 22, 2012 12:43 am

Re: scripts\rom/bot.lua:681: bad argument #1

#3 Post by abron1 » Thu Jan 31, 2013 3:34 pm

ok thanks rock

now why is it a option to set to true or false if i might ask?

because i use this and for some reason its not equiping the arrows

Code: Select all

if 999 > inventory:itemTotalCount("Runic Thorn") then
	inventory:useItem(212236) -- Use Rune Catapult 
	yrest(1000)
	RoMScript("UseEquipmentItem(10);")
	yrest(1000)
	inventory:useItem(213403) -- Use Shamrock Feather Bow
	yrest(1000)
	end

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

Re: scripts\rom/bot.lua:681: bad argument #1

#4 Post by rock5 » Fri Feb 01, 2013 1:58 am

I believe UseEquipmentItem(10) is the ammunition. Try 11. You may have got 10 from the bot but the bot uses different numbers.

If you wait for the bot to equip, it only checks the ammo every main bot loop. So that is not even after every fight. If you have to have arrows I would add a onPreSkillCast check, code copied from the bot

Code: Select all

				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition("arrow");
				end
  • 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: scripts\rom/bot.lua:681: bad argument #1

#5 Post by lisa » Fri Feb 01, 2013 2:37 am

abron1 wrote:because i use this and for some reason its not equiping the arrows
that code you posted is fine as it is, it will create the arrows, the bot should be using arrows as it needs them, as long as you set the profile option correctly.

Code: Select all

<option name="RELOAD_AMMUNITION" 	value="arrow" />
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: scripts\rom/bot.lua:681: bad argument #1

#6 Post by rock5 » Fri Feb 01, 2013 3:01 am

You're right. I was looking at a different command. So even the in-game functions use different numbers.
  • 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: scripts\rom/bot.lua:681: bad argument #1

#7 Post by lisa » Fri Feb 01, 2013 3:08 am

code he posted switches ranged weapon and then uses the ranged weapon which creates the arrows and then switches the weapon back. So that code is fine.

The game itself used to equip arrows as it needed them, you would do an attack after running out and then the next time you try to attack it would equip arrows it found in inventory. Not sure if that changed at any stage, been a long time since I have gone through 999 arrows while playing manually.

Just tested it by splitting stacks with just 1 arrow and then manually attacking, it autoequiped more arrows.
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: scripts\rom/bot.lua:681: bad argument #1

#8 Post by rock5 » Fri Feb 01, 2013 3:26 am

lisa wrote:code he posted switches ranged weapon and then uses the ranged weapon which creates the arrows and then switches the weapon back. So that code is fine.
I'm aware of that. The confusion was because I saw another command "EquipItem" uses 11 for the ranged weapon. Yeah, so, different in-game functions use different numbers.
lisa wrote:The game itself used to equip arrows as it needed them, you would do an attack after running out and then the next time you try to attack it would equip arrows it found in inventory.
You're right. Didn't think about (forgot about) 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

abron1
Posts: 162
Joined: Wed Feb 22, 2012 12:43 am

Re: scripts\rom/bot.lua:681: bad argument #1

#9 Post by abron1 » Fri Feb 01, 2013 3:51 am

thanks guys i got it going now with your help

next question is it possible for the bot not try to reload the ammo if there is not a scout class there... because of the three classes there are times you use the same profile but not with the scout class.. and the bot will try to reload arrows and because you don't have the scout in the combo it will just keep spamming trying to reload and causes your game to freeze up or run very slow...

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

Re: scripts\rom/bot.lua:681: bad argument #1

#10 Post by lisa » Fri Feb 01, 2013 4:11 am

TBH I don't think the bot needs to reload arrows because the game does it automatically, well for scout as main class, not sure about scout as second class.

Could add in a class check in the reload ammo code I guess.
Pretty sure only scouts can use arrows, so class1 or class2 has to be scout in order to use them.

Just tested on a */S and it reloaded arrows automatically, so don't really need to reload arrows at all, well IMHO anyway.

Actually I remember now, it reloads an arrow that you had previously, if no arrow in the ammo slot then it doesn't put in an arrow.

So maybe something like this?

Code: Select all

		-- reloading ammunition
		if ( settings.profile.options.RELOAD_AMMUNITION ) then
			local ammo = string.lower(settings.profile.options.RELOAD_AMMUNITION);
			if  ammo == "thrown" then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition(ammo);
				end
			elseif ammo == "arrow" and (player.Class2 == CLASS_SCOUT or player.Class1 == CLASS_SCOUT) then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition(ammo);
				end	
			else
			    print("RELOAD_AMMUNITION can only be false, arrow or thrown!");
			end
		end
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: scripts\rom/bot.lua:681: bad argument #1

#11 Post by rock5 » Fri Feb 01, 2013 4:30 am

There are 2 situations that the bot needs to equip the arrows, that I can think of. 1. is if you don't already have ammo equipped, eg. if you run out of arrows then later acquire some or if you use a Rune weapon so you always start with no arrows equipped. 2. If you run out of the arrows you are using and you need to equip some other type of arrows you have in your inventory.

Ah, looks like you figured it out while I was writing.

Code looks good. I wonder, do we need to do a check for class for the thrown ammo too?
  • 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: scripts\rom/bot.lua:681: bad argument #1

#12 Post by lisa » Fri Feb 01, 2013 4:39 am

rock5 wrote:do we need to do a check for class for the thrown ammo too?
thrown is just rogue?

Code: Select all

		-- reloading ammunition
		if ( settings.profile.options.RELOAD_AMMUNITION ) then
			local ammo = string.lower(settings.profile.options.RELOAD_AMMUNITION);
			if  ammo == "thrown" and (player.Class2 == CLASS_ROGUE or player.Class1 == CLASS_ROGUE) then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition(ammo);
				end
			elseif ammo == "arrow" and (player.Class2 == CLASS_SCOUT or player.Class1 == CLASS_SCOUT) then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition(ammo);
				end	
			else
			    print("RELOAD_AMMUNITION can only be false, arrow or thrown!");
			end
		end
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: scripts\rom/bot.lua:681: bad argument #1

#13 Post by rock5 » Fri Feb 01, 2013 5:03 am

An extra complication occurs to me. With Rogue as second class the Projectile Training skill is only available at level 12. So maybe

Code: Select all

        if  ammo == "thrown" and (player.Class1 == CLASS_ROGUE or (player.Class2 == CLASS_ROGUE and player.Level > 11 and player.Level2 > 11)) then
  • 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: scripts\rom/bot.lua:681: bad argument #1

#14 Post by lisa » Fri Feb 01, 2013 5:19 am

So this?

Code: Select all

		-- reloading ammunition
		if ( settings.profile.options.RELOAD_AMMUNITION ) then
			local ammo = string.lower(settings.profile.options.RELOAD_AMMUNITION);
			if  ammo == "thrown" and (player.Class1 == CLASS_ROGUE or (player.Class2 == CLASS_ROGUE and player.Level > 11 and player.Level2 > 11)) then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition(ammo);
				end
			elseif ammo == "arrow" and (player.Class2 == CLASS_SCOUT or player.Class1 == CLASS_SCOUT) then
				if inventory:getAmmunitionCount() == 0 then
					inventory:reloadAmmunition(ammo);
				end	
			else
			    print("RELOAD_AMMUNITION can only be false, arrow or thrown!");
			end
		end
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: scripts\rom/bot.lua:681: bad argument #1

#15 Post by rock5 » Fri Feb 01, 2013 7:18 am

Yep, looks good.
  • 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

abron1
Posts: 162
Joined: Wed Feb 22, 2012 12:43 am

Re: scripts\rom/bot.lua:681: bad argument #1

#16 Post by abron1 » Sat Feb 02, 2013 9:45 pm

ok cool so am i to add this or are you guys going to add it to the bot?

and can we do a inventory check for the rune bow or xbow to use and make arrows in this code also. So if we don't have arrows in the backpack and we have rune bow or xbox then use and equip arrows?

and while we are at it. The posion the bot only buys the one used by s/r and not the one used by all rogues.
Last edited by abron1 on Sat Feb 02, 2013 9:54 pm, edited 1 time in total.

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

Re: scripts\rom/bot.lua:681: bad argument #1

#17 Post by lisa » Sat Feb 02, 2013 9:50 pm

abron1 wrote:ok cool so am i to add this or are you guys going to add it to the bot?

and while we are at it. The posion the bot only buys the one used by s/r and not the one used by all rogues.
looks like I commited it in 747 ;)
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

abron1
Posts: 162
Joined: Wed Feb 22, 2012 12:43 am

Re: scripts\rom/bot.lua:681: bad argument #1

#18 Post by abron1 » Sat Feb 02, 2013 9:56 pm

hahha you fast

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

Re: scripts\rom/bot.lua:681: bad argument #1

#19 Post by lisa » Sat Feb 02, 2013 10:14 pm

nah do that in your profile for that character, out of the 100000's of */S or S/* out there less than half would actually have a bow to make arrows.

Code: Select all

	<onLoad><![CDATA[
	if 999 > inventory:itemTotalCount("Runic Thorn") then
		inventory:useItem(212236) -- rune war bow, can't remember which
		yrest(1000)
		RoMScript("UseEquipmentItem(10);")
		yrest(1000)
		inventory:useItem(212871) -- actual bow you use
		yrest(1000)
	end
	]]></onLoad>
and same again in the onleavecombat.
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

abron1
Posts: 162
Joined: Wed Feb 22, 2012 12:43 am

Re: scripts\rom/bot.lua:681: bad argument #1

#20 Post by abron1 » Mon Feb 04, 2013 3:35 am

would this code work not sure how to use the "or" in my codes

Code: Select all

if player.Class1 == CLASS_SCOUT or player.Class2 == CLASS_SCOUT then
	if 1 > inventory:itemTotalCount("Rune Catapult" or "Rune War Bow") then
	if 999 > inventory:itemTotalCount("Runic Thorn") then
	inventory:useItem(212236) or inventory:useItem(212183) -- Use Rune Catapult or Rune War Bow
	yrest(1000)
	RoMScript("UseEquipmentItem(10);")
	yrest(1000)
	inventory:useItem(213403) -- Use Shamrock Feather Bow
	yrest(1000)
	inventory:useItem(212185) -- Use Arrows
	end

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests