BUFF REMOVAL when running a SCRIPT

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Partyatthezoo
Posts: 11
Joined: Sun Nov 25, 2018 8:04 am

BUFF REMOVAL when running a SCRIPT

#1 Post by Partyatthezoo » Mon Aug 05, 2019 8:39 am

Hello everyone, i found out that when i am doing butterflies daily, at the beginning of the script the bot automatically removes my "Dual-Function Daily Quest Potion" buff for no reason.

I have checked the waypoint and there is nothing that could provoke that imo.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	settings.profile.mobs = {"105413"};
	player:target_Object("105413", 1000)
</onLoad>

	<!-- #  1 --><waypoint x="6423" z="5448" y="151">
			player:target_Object(118072) -- Robbie Butcher
			AcceptQuestByName(424181) -- Catch Butterflies
			player:mount();
	</waypoint>
	<!-- #  3 --><waypoint x="6316" z="4988" y="179" type="TRAVEL">	</waypoint>
	<!-- #  4 --><waypoint x="6570" z="3940" y="201" type="TRAVEL">	</waypoint>
	<!-- #  5 --><waypoint x="6610" z="3759" y="171" type="TRAVEL">	</waypoint>
	<!-- #  6 --><waypoint x="7036" z="3488" y="188" type="TRAVEL">	</waypoint>
	<!-- #  7 --><waypoint x="7138" z="3155" y="187" type="TRAVEL">	</waypoint>
	<!-- #  8 --><waypoint x="7362" z="3213" y="180" type="TRAVEL">	</waypoint>
	<!-- #  9 --><waypoint x="7340" z="3330" y="180" type="TRAVEL">	</waypoint>
	<!-- # 10 --><waypoint x="7455" z="3364" y="180" type="TRAVEL">	</waypoint>
	<!-- # 11 --><waypoint x="7510" z="3176" y="179" type="TRAVEL">	</waypoint>
	<!-- # 12 --><waypoint x="7626" z="3186" y="179" type="TRAVEL">	</waypoint>
	<!-- # 13 --><waypoint x="7659" z="3083" y="180" type="TRAVEL">	</waypoint>
	<!-- # 14 --><waypoint x="7551" z="3032" y="180" type="TRAVEL">	</waypoint>
	<!-- # 15 --><waypoint x="7574" z="2845" y="180" type="NORMAL">	yrest(1000)</waypoint>
	<!-- # 16 --><waypoint x="7564" z="2680" y="181" type="NORMAL">	yrest(1000)</waypoint>
	<!-- # 17 --><waypoint x="7563" z="2435" y="180" type="NORMAL">	</waypoint>
	<!-- # 18 --><waypoint x="7621" z="2098" y="180" type="NORMAL">	</waypoint>
	<!-- # 19 --><waypoint x="7468" z="2048" y="181" type="NORMAL">		player:mount();</waypoint>
	<!-- # 20 --><waypoint x="7468" z="2048" y="181" type="NORMAL">	</waypoint>
	<!-- # 22 --><waypoint x="7668" z="2074" y="179" type="TRAVEL">	</waypoint>
	<!-- # 23 --><waypoint x="7539" z="2765" y="179" type="TRAVEL">	</waypoint>
	<!-- # 24 --><waypoint x="7570" z="2932" y="180" type="TRAVEL">	</waypoint>
	<!-- # 25 --><waypoint x="7559" z="3034" y="180" type="TRAVEL">	</waypoint>
	<!-- # 26 --><waypoint x="7650" z="3090" y="180" type="TRAVEL">	</waypoint>
	<!-- # 27 --><waypoint x="7633" z="3181" y="179" type="TRAVEL">	</waypoint>
	<!-- # 28 --><waypoint x="7521" z="3173" y="180" type="TRAVEL">	</waypoint>
	<!-- # 29 --><waypoint x="7428" z="3371" y="179" type="TRAVEL">	</waypoint>
	<!-- # 30 --><waypoint x="7342" z="3333" y="179" type="TRAVEL">	</waypoint>
	<!-- # 31 --><waypoint x="7365" z="3207" y="180" type="TRAVEL">	</waypoint>
	<!-- # 32 --><waypoint x="7180" z="3172" y="189" type="TRAVEL">	</waypoint>
	<!-- # 33 --><waypoint x="7067" z="3357" y="188" type="TRAVEL">	</waypoint>
	<!-- # 34 --><waypoint x="6992" z="3524" y="188" type="TRAVEL">	</waypoint>
	<!-- # 35 --><waypoint x="6619" z="3752" y="170" type="TRAVEL">	</waypoint>
	<!-- # 36 --><waypoint x="6537" z="4040" y="201" type="TRAVEL">	</waypoint>
	<!-- # 37 --><waypoint x="6312" z="4957" y="179" type="TRAVEL">	</waypoint>
	<!-- # 38 --><waypoint x="6418" z="5425" y="167" type="TRAVEL">
			player:target_NPC(118072) -- Robbie Butcher
			CompleteQuestByName(424181) -- Catch Butterflies
				
	yrest(1000)
	local dqCount = RoMScript("Daily_count()");
		if dqCount == 10 then
			if inventory:itemTotalCount(202434) >= 1 then
				inventory:useItem(202434);
				yrest(1000)
			else
				printf("No Daily Reset Cards left!\n")
				player:sleep();      
			end	
		end
	</waypoint>
</waypoints>
Does anyone know why could this happen?

NOTE: i think that other buffs as "Unbridled Enthusiasm" (maiden speed potion) as also canceled (sometimes)

EDIT: found this in the console Use MACRO: Executing RoMScript "CancelPlayerBuff(12);".

How can i deactivate that?


Thanks!

User avatar
ThulsaDoom
Posts: 134
Joined: Mon Oct 19, 2015 2:46 pm

Re: BUFF REMOVAL when running a SCRIPT

#2 Post by ThulsaDoom » Tue Aug 06, 2019 10:52 am

The problem is at

Code: Select all

function CPlayer:mount(_dismount)
When the player target an enemy and want to attack it, the function check if is mounted. In case of mounted, before attack, try to unmount cancelling the buff (mount).
But the function doesn't work properlly and cancel always the first buff that player have, some cases is speed potion...

To fix this issue, you must know ROM programme structure and of course LUA code.

I can not do it...

Partyatthezoo
Posts: 11
Joined: Sun Nov 25, 2018 8:04 am

Re: BUFF REMOVAL when running a SCRIPT

#3 Post by Partyatthezoo » Tue Aug 06, 2019 6:21 pm

ThulsaDoom wrote: Tue Aug 06, 2019 10:52 am The problem is at

Code: Select all

function CPlayer:mount(_dismount)
When the player target an enemy and want to attack it, the function check if is mounted. In case of mounted, before attack, try to unmount cancelling the buff (mount).
But the function doesn't work properlly and cancel always the first buff that player have, some cases is speed potion...

To fix this issue, you must know ROM programme structure and of course LUA code.

I can not do it...
Hello! thanks for the reply!

I got what you said. I hope someone can say to me how to modify this! :(

User avatar
OluxZarjaNebesnogo
Posts: 31
Joined: Sat Nov 26, 2022 1:58 am

Re: BUFF REMOVAL when running a SCRIPT

#4 Post by OluxZarjaNebesnogo » Sat Jan 25, 2025 8:50 pm

Hi, this problem is still important.

When using the
player:dismount()
the bot cancels the first buff the character has. However I found some solution. But I'm not sure if this is correct :?

In the
player.lua
file, the lines:

Code: Select all

-- if _dismount and mountmethod is inventory then assume buff name equals item name and cancel buff if exists. Mainly needed for 15m and 2h mounts
	if _dismount and mountMethod == "inventory" then
		self:updateBuffs()
		for index, buff in pairs(self.Buffs) do
			if string.find(mount.Name,buff.Name,1, true) == 1 then
				sendMacro("CancelPlayerBuff("..index..");")
				return
			end
		end
	end 
Replace:

Code: Select all

string.find(mount.Name,buff.Name,1, true) == 1 
With:

Code: Select all

string.find(mount.Name,buff.Name,1, true) == 20
As I understand it, in this case the bot will look at the character’s buffs starting from 20, not from the first, and will cancel the mount’s buff if it was applied to the character last. Of course, this will work correctly if the character already has no more than 20 buffs.

I'm not very good at this, but it works for me :idea:
Sorry for my English!

User avatar
Administrator
Site Admin
Posts: 5328
Joined: Sat Jan 05, 2008 4:21 pm

Re: BUFF REMOVAL when running a SCRIPT

#5 Post by Administrator » Sun Jan 26, 2025 1:42 pm

string.find() docs

string.find
returns the index where the match occurred. Returning 1 means that the string starts with the given pattern.

That code works by comparing the mount's name to the buff's description to find the index of the buff associated with the mount. I think what is happening with your change is that it is causing that whole block to never find the mount buff and as a result will instead use another method to try dismounting. You could try commenting that section out or removing it to see if you have the same behavior.

User avatar
OluxZarjaNebesnogo
Posts: 31
Joined: Sat Nov 26, 2022 1:58 am

Re: BUFF REMOVAL when running a SCRIPT

#6 Post by OluxZarjaNebesnogo » Tue Jan 28, 2025 9:06 am

Administrator wrote: Sun Jan 26, 2025 1:42 pm That code works by comparing the mount's name to the buff's description to find the index of the buff associated with the mount. I think what is happening with your change is that it is causing that whole block to never find the mount buff and as a result will instead use another method to try dismounting. You could try commenting that section out or removing it to see if you have the same behavior.
You're right. I commented out this section and when using the mount, other character buffs are not canceled. Both with and without the
player:dismount()
function. Problem solved. Thanks :)
Sorry for my English!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests