Syntax Questions

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Syntax Questions

#1 Post by kenzu38 »

Hi guyz, I have other questions about syntax.

1.) How do I use CheckForBuff? What's the correct syntax for it? Let's say I wanna check if Essence of Magic buff is on, if it doesn't have it then it will cast the skill. How do you code that?

Also, for CheckForBuff to work, you have to add it to a custom userfunctions.lua but I'm wondering where exactly I should put this file. Should it be in the rom folder or the rom/userfunctions folder?

2.) How do I change skill options using ChangeProfileSkill command?

I tried these codes earlier and they didn't work:

Code: Select all

		changeProfileSkill("MAGE_THUNDERSTORM" , "priority", 100);
		changeProfileSkill("MAGE_FLAME" , "priority", 0);
and then without ""

Code: Select all

		changeProfileSkill("MAGE_THUNDERSTORM" , priority, 100);
		changeProfileSkill("MAGE_FLAME" , priority, 0);
My mage char was still casting Flame very often. I was using userdefault xml.

Right now, I got it to work using a new profile I made and using the loadProfile command.

But I still want to use ChangeProfileSkill if possible, so please tell me what I did wrong. Thanks.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Syntax Questions

#2 Post by lisa »

the usage of the function is correct, as such.

Code: Select all

changeProfileSkill("MAGE_THUNDERSTORM" , "priority", 100);
You can't change priority like that though because the priority is used to resort the order of skills when the profile is loaded, so because the table is already done changing the priority of any skill will have no affect.

Pretty sure Rock knows a solution for that, some function he probably added at some stage like
reloadskills()
or something similar =)

try this

Code: Select all

changeProfileSkill("MAGE_THUNDERSTORM" , "priority", 100);
changeProfileSkill("MAGE_FLAME" , "priority", 10);
settings.loadSkillSet(player.Class1)
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: Syntax Questions

#3 Post by rock5 »

1. The bot should do this automatically once the skill is added to the skills list in your profile. Otherwise to do this manually you can use the function hasBuff. You could use it like this.

Code: Select all

if player:hasBuff("Essence of Magic") == false then
    player:cast("MAGE_ESSENCE_OF_MAGIC")
end
2. The next revision of the bot will have a fix for this in changeProfileSkill. Basically you just need to re-sort the skills after changing priorities.

Code: Select all

table.sort(settings.profile.skills, function(a,b) return a.priority > b.priority 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
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Syntax Questions

#4 Post by kenzu38 »

Ok, thanks guyz. Server's down atm but will test these codes as soon as it's up.
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Syntax Questions

#5 Post by kenzu38 »

Hey rock, I am having a problem getting the code you posted to work with the Snowflake Tree buff. Here is my code:

Code: Select all

<onLoad>		
	loadProfile("profile");
	if player:hasBuff("Language of Splendidness") == false then
    	loadPaths("rebbuffwpfile");
	end
</onLoad>
It doesn't seem to recognize when the buff has run out. Does the buff have to be included in the bot's list to be recognized?

Any idea how to fix this? Thanks.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Syntax Questions

#6 Post by rock5 »

It looks ok. Are you sure the buff you get is called that? Sometimes the buff name and the name of the buff when it's on you, is different.
  • 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
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Syntax Questions

#7 Post by kenzu38 »

Here's the screenshot:

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

Re: Syntax Questions

#8 Post by kenzu38 »

Ok, I think I found the problem.

My getbuff waypoint has almost the same start and end points and the farming waypoint file also has almost the same paths so I think the bot is getting all of them mixed up.

Anyway, I'm thinking of just making my getbuff waypoint into a function within my farming waypoint but since I'm new to coding, I don't know how to do this properly.

Can anyone help with this? This is what I have so far, please let me know what's wrong:

Code: Select all

<onLoad>		
	loadProfile("profile");
	function farm()
	<!-- # 1 --><waypoint x="13003" z="3273" y="68">	</waypoint>
	<!-- #  2 --><waypoint x="13163" z="3215" y="80">	</waypoint>
	<!-- #  3 --><waypoint x="13069" z="3478" y="69">	</waypoint>
	<!-- #  4 --><waypoint x="13096" z="3627" y="66">	</waypoint>
	<!-- #  5 --><waypoint x="12843" z="3567" y="56">	</waypoint>
	end
	function getbuff()
             <insert some waypoints here>
	<!-- #  10 --><waypoint x="2760" z="967" y="53">		NPCTeleport("Lieve", "Central Plaza", "somewhere else");
	</waypoint>
	<!-- # 12 --><waypoint x="4965" z="-2185" y="113">		player:target_NPC("Kolu Max");
		sendMacro("ChoiceOption(1);");
		yrest(1000);
		player:target_NPC("Splendid Snowflake Tree");
		sendMacro("ChoiceOption(1);");
		yrest(1000);
	</waypoint>
                     <insert some waypoints here>
	end
</onLoad>
	<!-- #  1 --><waypoint x="12857" z="2761" y="64">
	if player:hasBuff("Language of Splendidness") == false then
	getbuff()
	else
	farm()
	end
	</waypoint>
</waypoints>
When I ran it, the bot just keeps going to waypoint x="12857" z="2761". So can someone point out the error? Thanks.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Syntax Questions

#9 Post by rock5 »

You can't have waypoints in the onload or in a function.

If your getbuff waypoint has the start and end waypoint at the same location, you can make sure it goes to the first one by doing a setWaypointIndex in the onload.

Code: Select all

<onload>
    __WPL:setWaypointIndex(1)
</onload>
If you still want to put it all into one file it will take a bit more work and a longer explanation.
  • 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
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Syntax Questions

#10 Post by kenzu38 »

Ok, thanks! About the command, does (1) mean the first waypoint? If so, if I change it to let's say, 5, then it will go directly to the fifth waypoint?

Also, I'm interested in learning how to put them all in one file so if it's a really long explanation, can you just list the core commands I'll have to use? And then I'll just search the forum for some explanations about those commands.

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

Re: Syntax Questions

#11 Post by kenzu38 »

Ok, good thing I decided to look at the DoD script and it just answered my question about the __WPL:setWaypointIndex command.

It also seems like this is the way to get all my waypoints into one file. I'll try to make a script and just ask here if I encounter some problems.

Btw, it's Christmas! Happy Holidays everybody! :)
Post Reply