code to change channel after killin a mob

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
bankaikid
Posts: 3
Joined: Mon Oct 25, 2010 7:27 am

code to change channel after killin a mob

#1 Post by bankaikid »

i found on this forum the code to change channel, but i dont manage to make it work for my bot (goal is to farm a specific mob, loot it and change chanel every time it's killed ):
<onLeaveCombat><![CDATA[
sendMacro("ChangeParallelID(1)");
]]></onLeaveCombat>
is workin, but what i try to do is like :
<onLeaveCombat><![CDATA[
if( 1 = GetCurrentParallelID() )then sendMacro("ChangeParallelID(2)");
else sendMacro("ChangeParallelID(1)");
]]></onLeaveCombat>
and this one doesnt work. where is the mistake, i need some help ?

edit : in the end
<onLeaveCombat><![CDATA[
sendMacro("ChangeParallelID(1)");
sendMacro("ChangeParallelID(2)");
]]></onLeaveCombat>
works fine, but now the issue is i change channel before looting, is there a code for loot i could use before ?
swietlowka
Posts: 316
Joined: Wed Jun 16, 2010 8:16 am

Re: code to change channel after killin a mob

#2 Post by swietlowka »

bankaikid
Posts: 3
Joined: Mon Oct 25, 2010 7:27 am

Re: code to change channel after killin a mob

#3 Post by bankaikid »

i didnt seen, thx for the link.
but it doesnt solve the actual problem, i can already change channel after killing the mob i want, but it change channel before looting it ! rest function just make it wait before changing chan
what i need is code to say "loot mob" before the "sendMacro("ChangeParallelID(1)");"
swietlowka
Posts: 316
Joined: Wed Jun 16, 2010 8:16 am

Re: code to change channel after killin a mob

#4 Post by swietlowka »

oh, i didnt see anything about it in previouse post, maybe i didnt get u well :)
i would go for player:loot(); and then switch channel function in the onleavecombat section
bankaikid
Posts: 3
Joined: Mon Oct 25, 2010 7:27 am

Re: code to change channel after killin a mob

#5 Post by bankaikid »

thx !!! it was that one "player:loot();" i was lookin for , it works now !
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: code to change channel after killin a mob

#6 Post by rock5 »

bankaikid wrote:

Code: Select all

<onLeaveCombat><![CDATA[
		if( 1 = GetCurrentParallelID() )then sendMacro("ChangeParallelID(2)");
		else sendMacro("ChangeParallelID(1)");
 ]]></onLeaveCombat>
BTW, I can tell you how to fix this, for future reference.
1. When making comparisons you use '==' not '='.
2. 'If' statements finish with an 'end'.
3. 'GetCurrentParallelID' is an ingame function so you need to use RoMScript or sendMacro.

So this should work.

Code: Select all

<onLeaveCombat><![CDATA[
		if( 1 == RoMScript("GetCurrentParallelID()") ) then sendMacro("ChangeParallelID(2)");
		else sendMacro("ChangeParallelID(1)"); end
 ]]></onLeaveCombat>
  • 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
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: code to change channel after killin a mob

#7 Post by Giram »

Does it work differently if you write those commands inside cdata tags? I have always written my code outside of cdata tags.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: code to change channel after killin a mob

#8 Post by rock5 »

Giram wrote:Does it work differently if you write those commands inside cdata tags? I have always written my code outside of cdata tags.
I don't think so. I also don't use cdata tags. I believe the main advantage to using them is you don't get errors when using xml symbols like '<' in your lua code. (Don't quote me though)
  • 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
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: code to change channel after killin a mob

#9 Post by Administrator »

Yes, CDATA tags are just to prevent any confusion in the XML parser when using certain symbols (such as '<'). Any code that is longer than a few lines should probably be inside CDATA tags, but it is not necessary.
Post Reply