 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Nov 03, 2005 5:11 am
looping, vars & database, oh my! |
So, I had the great idea of compiling the information from several sources on Aardwolf and put it all together in on nice neat format in note form for my clan. Came up with this:
#FUNCTION padleft {%concat( %repeat( " ", %eval( %2-%len( %1))), %1)}
#CLASS {ImperiumMembers}
#ALIAS rollcall {
#VARIABLE ImperiumMembers {}
#T+ rollcalltrig
#T+ rollcallcount
#T+ ImperiumMembersRankings
roster imperium 1
}
#VAR ImperiumMembers {Vampirella|Vitae}
#TRIGGER "rollcalltrig" {%s%d%s(%w)%s*} {
#ADDITEM ImperiumMembers %1
#VARIABLE %1 {} _nodef {ImperiumMembers}
} "" {disable}
#TRIGGER "rollcallcount" {(%d) members counted.} {
#T- rollcalltrig
#LOOP 1,%1 {myrank %word( @ImperiumMembers, %i, "|")}
#T- rollcallcount
} "" {disable}
#TRIGGER "ImperiumMembersRankings" {%sRankings for (%w)} {
#IF {%ismember( %1, @ImperiumMembers)} {
#VARIABLE ActiveMember {%1}
#T+ myrank6
#T+ myrank10
#T+ myrank15
#T+ myrank16
#T+ myrank18
} {}
}
#TRIGGER "myrank6" {%s6%sQuests completed%s({%d|N/A})%sof%s%d} {#VARIABLE @{ActiveMember}.myrank6 %additem( "%1")} "" {disable}
#TRIGGER "myrank10" {%s10%sWarfare kills%s({%d|N/A})%sof%s%d} {#VARIABLE @{ActiveMember}.myrank10 %additem( "%1")} "" {disable}
#TRIGGER "myrank15" {%s15%sRooms explored%s({%d|N/A})%sof%s%d} {#VARIABLE @{ActiveMember}.myrank15 %additem( "%1")} "" {disable}
#TRIGGER "myrank16" {%s16%sPowerups ~(since v2~)%s({%d|N/A})%sof%s%d} {#VARIABLE @{ActiveMember}.myrank16 %additem( "%1")} "" {disable}
#TRIGGER "myrank18" {%s18%sCampaigns completed%s({%d|N/A})%sof%s%d} {
#VARIABLE @{ActiveMember}.myrank18 %additem( "%1")
#T- myrank6
#T- myrank10
#T- myrank15
#T- myrank16
#T- myrank18
} "" {disable}
#VAR ActiveMember {}
#VAR Vampirella {myrank62388myrank10N/Amyrank151763myrank161165myrank181489}
#VAR Vitae {myrank6307myrank10116myrank15315myrank161122myrank18943}
#ALIAS reportall {
bo 17
note write vitae
test
#SEND _______________________________________________________________
#SEND %format( "&23s", "|MyRank 6|")%format( "&9s", "MyRank 10|")%format( "&9s", "MyRank 15|")%format( "&9s", "MyRank 16|")%format( "&9s", "MyRank 18|")
#SEND -------------|--------|---------|---------|---------|---------|
#SEND "Vampirella |"@padleft( "@Vampirella.myrank6", 8)|@padleft( "@Vampirella.myrank10", 9)|@padleft( "@Vampirella.myrank15", 9)|@padleft( "@Vampirella.myrank16", 9)|@padleft( "@Vampirella.myrank18", 9)|
#SEND "Vitae |"@padleft( "@Vitae.myrank6", 8)|@padleft( "@Vitae.myrank10", 9)|@padleft( "@Vitae.myrank15", 9)|@padleft( "@Vitae.myrank16", 9)|@padleft( "@Vitae.myrank18", 9)|
#SEND _______________________________________________________________
end
p
}
#ALIAS reportall1 {
#ECHO %ansi( white)_______________________________________________________________
#ECHO %format( "&23s", "|MyRank 6|")%format( "&9s", "MyRank 10|")%format( "&9s", "MyRank 15|")%format( "&9s", "MyRank 16|")%format( "&9s", "MyRank 18|")
#ECHO %ansi( white)-------------|--------|---------|---------|---------|---------|
#LOOP 1,%numwords( @ImperiumMembers, "|") {#ECHO %ansi( high, green)%word( @ImperiumMembers, %i, "|")}
}
#ALIAS reportall2 {
#ECHO %ansi( white)_______________________________________________________________
#ECHO %format( "&23s", "|MyRank 6|")%format( "&9s", "MyRank 10|")%format( "&9s", "MyRank 15|")%format( "&9s", "MyRank 16|")%format( "&9s", "MyRank 18|")
#ECHO %ansi( white)-------------|--------|---------|---------|---------|---------|
#LOOP 1,%numwords( @ImperiumMembers, "|") {#SHOW %exec ( @{%word( @ImperiumMembers, %i, "|")}.myrank6)}
}
#ALIAS unrollcall {
#LOOP 1,%numwords( @ImperiumMembers, "|") {
#GAG Variable %word( @ImperiumMembers, %i, "|") removed.
#UNVAR %word( @ImperiumMembers, %i, "|") "ImperiumMembers"
}
#T- ImperiumMembersRankings
}
#CLASS 0
Used Pretty Print
Syntax Colourizer
NOTE: Variables have been cut WAY down. There's 25 members currently, but I'm just displaying myself and my spouse in this post
.
Once I type rollcall it populates all the vars creating vars for each and every member of the clan (want it this way since if a new member joins, or an old one outcasts I always have a fresh membership list.)
Everything works fine. The only thing is the way reportall works.
The end result is how I'd like it:
Code: |
_______________________________________________________________
|MyRank 6|MyRank 10|MyRank 15|MyRank 16|MyRank 18|
-------------|--------|---------|---------|---------|---------|
Vampirella | 2388| N/A| 1763| 1165| 1489|
Vitae | 307| 116| 315| 1122| 943|
_______________________________________________________________ |
But in order for this to come out I have maintain it (as I said, if someone leaves or joins) and it can get tedious.
I tried to figure out how to get it to go thru a #loop and give out the infomation.
reportall1 was a test & it works but I only set it to display the member names.
Code: |
_______________________________________________________________
|MyRank 6|MyRank 10|MyRank 15|MyRank 16|MyRank 18|
-------------|--------|---------|---------|---------|---------|
Vampirella
Vitae |
reportall2 was a test to see if I can get it to display the myrank stuff and it is obvious that SOMETHING is wrong with it.
Code: |
|MyRank 6|MyRank 10|MyRank 15|MyRank 16|MyRank 18|
-------------|--------|---------|---------|---------|---------|
(myrank62388myrank10N/Amyrank151763myrank161165myrank181489.myrank6)
(myrank6307myrank10116myrank15315myrank161122myrank18943.myrank6) |
As you can tell, that is not exactly right...
Ideally, what I would like is to also have the player names padded as well. But I don't know how to do that. (I can't even figure out why the function will not work if it's in the ImperiumMembers class. only works in the main folder.)
I mean, hell, I don't REALLY need the |'s but I would like them to make it easier to read.
Another ideal on this would be if for each rank it colored bright red the lowest # (the higher the rank you are the lower your #) @R is Aard's color code for bright red
If anyone can help me on this i'd appreciate it.
I just KNOW that it's something simple and stupid that I am missing on it.
But i tried several different way with the reportall2 test and none of them worked with a loop. |
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Nov 03, 2005 8:24 pm |
Well, oddly enuf, I was able to work this mostly all out on my own :-)
Alias reportall
#SEND ______________________________________________________________
#SEND {" |MyRank 6|MyRank 10|MyRank 15|MyRank 16|MyRank 18|"}
#SEND ------------|--------|---------|---------|---------|---------|
#FORALL @ImperiumMembers {#EXECUTE @padright("%i",12)|@padleft("@%i.myrank6",8)|@padleft("@%i.myrank10",9)|@padleft("@%i.myrank15",9)|@padleft("@%i.myrank16",9)|@padleft("@%i.myrank18",9)|}
#SEND ------------|--------|---------|---------|---------|---------|
#FUNCTION padright {%concat( %1, %repeat( " ", %eval( %2-%len( %1))))}
result
Code: |
______________________________________________________________
|MyRank 6|MyRank 10|MyRank 15|MyRank 16|MyRank 18|
------------|--------|---------|---------|---------|---------|
Vampirella | 2388| N/A| 1767| 1165| 1489|
Vitae | 307| 116| 315| 1122| 943|
------------|--------|---------|---------|---------|---------| |
Even the player names are padded.
The one thing that I couldn't figure out was how to get the lowest # in each rank highlited.
Starting to think that doing it as charname with ranks stored is not the way to go. And store each rank with char names so that all the #'s for each rank are together and THEN should be easily colorable.
Have to play around with it.
But if anyone has a way to color it as is please let me know.
Or show me how to do it the other way. |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|