Player class check

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

Player class check

#1 Post by kenzu38 »

Hi guyz, need help with two things:

1.) Code for checking if you're currently on your secondary class or tertiary class.

2.) Code for checking if you are currently playing a mage class.

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

Re: Player class check

#2 Post by rock5 »

kenzu38 wrote:1.) Code for checking if you're currently on your secondary class or tertiary class.
Hm... What makes a particular class your primary, secondary or tertiary class? If your primary class has the highest level then you can check the class levels. The values to check are

Code: Select all

player.Level      -- It's not a typo. There is no '1'.
player.Level2
player.Level3
kenzu38 wrote:2.) Code for checking if you are currently playing a mage class.
To check what exactly the classes are you would check

Code: Select all

player.Class1
player.Class2
player.Class3
Class is saved as numbers. You would use the class static variables for making comparisons eg.

Code: Select all

if player.Class1 == CLASS_MAGE then
    etc.
I hope that helps.
  • 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: Player class check

#3 Post by kenzu38 »

rock5 wrote:Hm... What makes a particular class your primary, secondary or tertiary class? If your primary class has the highest level then you can check the class levels.
I see, yea it would be hard to distinguish between them. Yes, I see, I could just check levels, good thing all my chars have their primary classes are at way higher levels than their secondary. Or else checking levels wouldn't work.
rock5 wrote:

Code: Select all

if player.Class1 == CLASS_MAGE then
    etc.

I hope that helps.
It sure does. Thanks a lot!
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Player class check

#4 Post by kenzu38 »

Ok so, I got the class check to work but I'm having problems with checking for levels. How exactly should I code it?

I have this right now:

Code: Select all

		if player.Level < player.Level2 or player.Level < player.Level3 then
			-- Wait for user to change class
			cprintf(cli.yellow,"You are not playing your highest level class, are you sure you want to continue\n")
			player:sleep()
			end	
It always errors. Can someone point out what I am doing wrong? Thanks.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Player class check

#5 Post by rock5 »

If you are reporting an error you should include it to help us figure out what's wrong, otherwise we would have to guess. :)

So I'll guess, you got an "invalid token" error. This is because you used the code in an xml file and it assumed the < is a beginning of a 'token', ie. <waypoint, <onload etc. You can use '>' so just switch them around.

Code: Select all

      if player.Level2 > player.Level or player.Level3 < player.Level 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
kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: Player class check

#6 Post by kenzu38 »

Lol well, I had a hunch it was just some elementary syntax mistake that a newbie can easily overlook and an experienced coder would spot right away so I didn't bother posting what the error was. :D

But yes, you were right on the mark, it was an invalid token error. And I guess I was right on the mark that it was a basic mistake haha.

But yes, I admit it's not a good habit to post questions without the error messages so I'll try to keep this in mind next time.

Anyway, the check works fine now. Thanks a lot.

Though, I got a new code I need checked. Will this line work?

Code: Select all

sendMacro("ExchangeClass("..(CLASS_MAGE + 1)..", EXCHANGECLASS_SUBCLASS)");
It's because I want my code to be universal for all my mage chars with different subclasses. So I'm thinking of doing it like the above. So is it valid?

Thanks.

Edit: Ok, tried the above code just now and it didn't work, it only changed to Mage primary with no subclass.

Also tried this code:

Code: Select all

		local class1 = player.Class1
		sendMacro("ExchangeClass("..(CLASS_MAGE + 1)..","..class1..")");
Same thing, only changed to Mage with no subclass. So can anyone tell me how to do this properly? Thanks.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Player class check

#7 Post by rock5 »

kenzu38 wrote:sendMacro("ExchangeClass("..(CLASS_MAGE + 1)..", EXCHANGECLASS_SUBCLASS)");
Assuming the current main class is not Mage then I think what you want to do is move the main class into the sub class.

Code: Select all

sendMacro("ExchangeClass("..(CLASS_MAGE + 1)..", EXCHANGECLASS_MAINCLASS)");
That might work.
kenzu38 wrote: local class1 = player.Class1
sendMacro("ExchangeClass("..(CLASS_MAGE + 1)..","..class1..")");
You are forgetting the + 1.

Code: Select all

      local class1 = player.Class1
      sendMacro("ExchangeClass("..(CLASS_MAGE + 1)..","..(class1+1)..")");
  • 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: Player class check

#8 Post by kenzu38 »

Hehe yea, figured the first one out earlier when I was testing. Just changed to MAINCLASS and the code worked. Though, I was really puzzled by the second one until you reminded me of the +1.

Anyway, both codes working fine now. As always, thanks a lot, rock!
Post Reply