print player.class1 as the text
print player.class1 as the text
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
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
Re: print player.class1 as the text
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
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
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: print player.class1 as the text
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.
some other stats on char.
Badges are from arcanium
empties is free spaces left in bag
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.
I plan on adding player class 1 and 2Date/Time Name Level Max HP Gold Shells Tokens Mems Badges Puris Charges Empties Honor Guildname
some other stats on char.
Badges are from arcanium
empties is free spaces left in bag
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: print player.class1 as the text
You could always create a custom variable and function to create the class name for the log. Something like this:
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.
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")
Re: print player.class1 as the text
That code looks like it would work, I might have gone a different way though.
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?
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")
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
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: print player.class1 as the text
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.
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.
Re: print player.class1 as the text
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;
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;
Re: print player.class1 as the text
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
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.
[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.
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.
Re: print player.class1 as the text
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 328 times
Last edited by beanybabe on Sat Aug 13, 2016 7:23 pm, edited 1 time in total.
Re: print player.class1 as the text
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.
Re: print player.class1 as the text
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.
Who is online
Users browsing this forum: No registered users and 6 guests