print player.class1 as the text

Talk about anything in Runes of Magic. This does not need to pertain to botting.
Post Reply
Message
Author
User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

print player.class1 as the text

#1 Post by beanybabe » Sat Jan 23, 2016 11:18 am

im trying to get the class names so i can print to log file.

i see
if(player.Class1 == CLASS_SCOUT ) then

but if i print ( player.Class1) I get a number not the word Scout

I like to get the class1 and class2 and class3(if able) so i can print, Any ideas ?

priest,mage,scout

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

Re: print player.class1 as the text

#2 Post by lisa » Sat Jan 23, 2016 5:45 pm

The game itself uses numbers to represent the class types, the bot gave name values to match the numbers so that humans can use it easier without having to remember what is what.
In pawn.lua is this

Code: Select all

CLASS_NONE = -1;
CLASS_WARRIOR = 1;
CLASS_SCOUT = 2;
CLASS_ROGUE = 3;
CLASS_MAGE = 4;
CLASS_PRIEST = 5;
CLASS_KNIGHT = 6;
CLASS_WARDEN = 7;
CLASS_DRUID = 8;
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
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: print player.class1 as the text

#3 Post by beanybabe » Sat Jan 23, 2016 9:50 pm

I had noticed i could go
If player.Class1="druid" then ......
and was hoping it was easy to just say myclass=player.Class1 but it just gave me a number like you said.

I have been rewriting the Logplayer userfunction to include more detail I guess I could just put numbers in for the classes it would make the list a little less wide.
Date/Time Name Level Max HP Gold Shells Tokens Mems Badges Puris Charges Empties Honor Guildname
I plan on adding player class 1 and 2
some other stats on char.

Badges are from arcanium
empties is free spaces left in bag

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: print player.class1 as the text

#4 Post by noobbotter » Mon Jan 25, 2016 8:41 am

You could always create a custom variable and function to create the class name for the log. Something like this:

Code: Select all

local className ="None"
local function getClassName(classToGet)
	local className ="None"
	if classToGet == 1 then 
		className = "Warrior" 
	elseif classToGet == 2 then 
		className = "Scout" 
	elseif classToGet == 3 then 
		className = "Rogue" 
	elseif classToGet == 4 then 
		className = "Mage" 
	elseif classToGet == 5 then 
		className = "Priest" 
	elseif classToGet == 6 then 
		className = "Knight" 
	elseif classToGet == 7 then 
		className = "Warden" 
	elseif classToGet == 8 then 
		className = "Druid" 
	elseif classToGet == 9 then 
		className = "Warlock" 
	elseif classToGet == 10 then 
		className = "Champion" 
	else
		className = "UNDEFINED"
	end
	return className
end

printf("Player Primary/Secondary classes are "..getClassName(player.Class1).."/"..getClassName(player.Class2)..".\n")
I haven't tried it, just wrote it, and I'm not sure if I'm up to speed on returning values from functions, but it might work.

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

Re: print player.class1 as the text

#5 Post by lisa » Mon Jan 25, 2016 9:36 am

That code looks like it would work, I might have gone a different way though.

Code: Select all

local classtable = {
[1]="WARRIOR",
[2]="SCOUT",
[3]="ROGUE",
[4]="MAGE",
[5]="PRIEST",
[6]="KNIGHT",
[7]="WARDEN",
[8]="DRUID"
}

printf("Player Primary/Secondary classes are "..classtable[player.Class1].."/"..classtable[player.Class2]..".\n")
purely untested,
think about this though, when you do a table.print(player) it doesn't have a number for the class does it, it says the name?
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

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: print player.class1 as the text

#6 Post by noobbotter » Mon Jan 25, 2016 12:43 pm

I knew it would be much more efficient to do that via a table, but I always have to re-learn how to use tables every time I attempt to use one.

So how is it that if you table.print(player) it will print the name, but if you print player.Class1 is shows the number? That must mean that somewhere within the player class it has the names. I just don't see where.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: print player.class1 as the text

#7 Post by beanybabe » Tue Jan 26, 2016 6:29 pm

in pawn.lua it defines them.

CLASS_NONE = -1;
CLASS_WARRIOR = 1;
CLASS_SCOUT = 2;
CLASS_ROGUE = 3;
CLASS_MAGE = 4;
CLASS_PRIEST = 5;
CLASS_KNIGHT = 6;
CLASS_WARDEN = 7;
CLASS_DRUID = 8;
CLASS_WARLOCK = 9;
CLASS_CHAMPION = 10;

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: print player.class1 as the text

#8 Post by beanybabe » Tue Jan 26, 2016 7:05 pm

local classtable = {
[1]="WARRIOR",
[2]="SCOUT",
[3]="ROGUE",
[4]="MAGE",
[5]="PRIEST",
[6]="KNIGHT",
[7]="WARDEN",
[8]="DRUID",
[9]="WARLOCK",
[10]="CHAMPION"
}
----------------------------------------
This is another way to create same table if i read it correct.
classtable = {WARRIOR,SCOUT,ROGUE,MAGE,PRIEST,KNIGHT,WARDEN,WARDEN,DRUID,WARLOCK,CHAMPION}
So the code would be

Code: Select all

userfunction.....
local classtable = {"WARRIOR", "SCOUT", "ROGUE", "MAGE", "PRIEST", "KNIGHT", "WARDEN", "DRUID", "WARLOCK", "CHAMPION"}
local theclass1 = classtable[player.Class1]      --  () do not work here it needs to be []
local theclass2 = classtable[player.Class2]      --  () do not work here it needs to be []
print (theclass)    --   Should now give the word for the player class.  this will fail.
I cannot use player.Class1 inside a userfunction as it is not defined at the time userfunctions are loaded. So this needs be handled inside the calling program.

Code: Select all

userfunction someuserfunction
	function logPlayerx(_playrcla1,_playrcla2)
	print(_playrcla1,_playrcla2)                        --- HELP the class does not seem to be getting passed to here.**** never mind this worked I had renamed the userfunction but left it in folder and it was using old version.
	end 
end
-----------this is the calling progam
	local classtable = {"WARRIOR", "SCOUT", "ROGUE", "MAGE", "PRIEST", "KNIGHT", "WARDEN", "DRUID", "WARLOCK", "CHAMPION"}
	logPlayerx(classtable[player.Class1],classtable[player.Class2]);
	end
Last edited by beanybabe on Sat Aug 13, 2016 7:24 pm, edited 3 times in total.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: print player.class1 as the text

#9 Post by beanybabe » Tue Jan 26, 2016 8:57 pm

Finally got it working with class. this will create a list of shells arcanium eoj gold

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
local classtable = {"WARRIOR", "SCOUT", "ROGUE", "MAGE", "PRIEST", "KNIGHT", "WARDEN", "DRUID", "WARLOCK", "CHAMPION"}
logPlayer(classtable[player.Class1],classtable[player.Class2]);	
</onLoad>
</waypoints>

Code: Select all

Date/Time          Name           Level  Max HP   Gold         Shells  Tokens  Mems   Badges  Puris  Charges  Dly_item  Empties Honor    Guildname         class1    class2
01/26/16 19:46:24  **********      44     2,459    4,936,355    0       1,950   0      5       0      19       0         26      0        *********             ROGUE     WARDEN  
Attachments
userfunction_LogPlayer.lua
this is second mod of rocks i posted of this call it 1.3
(3.42 KiB) Downloaded 261 times
Last edited by beanybabe on Sat Aug 13, 2016 7:23 pm, edited 1 time in total.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: print player.class1 as the text

#10 Post by beanybabe » Wed Jan 27, 2016 4:14 pm

Will try to add account number or name next. Then I will see if I can create list for certain items in inventory or bank like mana stones or runes.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: print player.class1 as the text

#11 Post by beanybabe » Sat Aug 13, 2016 8:02 pm

The class table had error bill cat noticed it I had warden listed twice. if you used you may want to remove one of the wardens. I put this in my default userdefault and each custom profile then I always have list of moneys.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest