|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Thu Feb 01, 2018 7:07 am
Currently capturing, but want it re-ordered |
Way above me.. wanting to reorder this list:
Quote: |
[38 Svirf Thi] Ymelda the Mistress Thief
[51 Human Con] Ekeiki the Planewalker
[42 Felar Ran] Crashee the Caller of the Pack
[33 Storm War] (PK) Nhorljan the Warrior of the Gauntlet
[28 Fire War] (PK) [EMPIRE] Moebo the Veteran, Sheathed Blade
[46 Human Thi] [EMPIRE] Jiouvesh the Unseen, Imperial Shadow Lord
*30 Arial Asn* (PK) [EMPIRE] Xalsas the Ogoshi, Imperial Shadow
[10 Human Con] Castigan the Scholar of Magic
[51 D-Elf A-P] [EMPIRE] Orzmus Tyroz the Fist of Darkness, Imperial Dread Lord
[15 Storm Pal] Demnas the Esteemed
[21 Svirf War] Ansgarr the Strategist
[20 Elf Con] Piliear the Conjurer
[ 7 Human Asn] Radarak the 2nd Brown
[51 Dwarf Sha] Kruggy the Holy of Faith, Elder Prophet of the Light
[29 Human Nec] (PK) [EMPIRE] Vikka the Summoner, Black Servant
[51 Felar Asn] Kasic the Dai Sensei of the Miyama Ryu
[34 Dwarf War] (PK) Derigan the Warrior of the Shield
[51 Human Sha] Khellor Rash'Anadaanak the Student of Supplication and Sorcery
[51 Felar War] Leorne the Legend of the Battlefield
[51 W-Elf Bar] Ilouwi the Grand Mistress of Artistry
[13 H-Drw Thi] Varkys the Trickster, Bloodoathed of the Empire
Players found: 21 |
Currently I capture it with:
Code: |
#tr {~[{ |}{%d}{%s}{%x}{%s}{%x}~]} {#cap wholist} |
I want two things done.,..
1) break it into three groups - bottom to top: PK, EMPIRE, other
2) list from highest to lowest number within each of the groups |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu Feb 01, 2018 7:47 am |
Minor issues, in your pattern, to capture the individual segments into anonymous variables you want to use regular parentheses ().
Curly brackets {} are usually indicative of a variable being used in the pattern itself.
Code: |
#tr {~[{ |}(%d)%s(%x)%s(%x)~]{%s~(PK~)|}{%s~{EMPIRE~}|} (*)} {
$faction=other
#STATE (%match(%line, "(PK)")) {$faction=PK} (%match(%line, "{EMPIRE}")) {$faction=Empire}
//first we figure out what faction the person is in by testing the line for indicators - currently this only allows for one faction per person
$level=%1
$race=%2
$class=%3
$longName=%4
//Then we assign the basic variables, $locally
$name=%item(%replace(%item(%replace($longName, ", ", "|"), 1), " the ", "|"), 1)
$titles=%replace(%item(%replace($longName, ", ", "|"), 1), %concat($name, " the "))
$extraTitles=%item(%replace($longName, ", ", "|"), 2)
//Then we split up the more complex sections into thier respective variables, feel free to ask more if the logic gets confusing
$this=%db(@playerList, $faction)
$this=%db($this, $name)
//Then we pull up the current value from the database... this step could be skipped if you don't need to reference the current values
#ADDKEY $this Titles $titles
#ADDKEY $this Extra $extraTitles
#ADDKEY $this Level $level
#ADDKEY $this Race $race
#ADDKEY $this Class $class
//Next we update the local variable values
#ADDKEY playerList.${faction) $name $this
//And then update the main variable
#CAP wholist
} |
Once you have the data being captured to a database, you can then further manipulate it via an alias to display end results.
More on that in the next post. |
|
_________________ Discord: Shalimarwildcat
Last edited by shalimar on Thu Feb 01, 2018 7:29 pm; edited 2 times in total |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu Feb 01, 2018 9:15 am |
Now that we have a populated database (hopefully) to work off of, we can now manipulate the data.
Code: |
#ALIAS factionSort {
$faction=other
#IF (%1) {$faction=%1}
$this=%db(@playerList, $faction)
//First we pull up the current known value for a given $faction
#LOCAL $list
#FORALL %dbkeys($this) {
$name=%i
$that=%db($this, $name)
$level=%db($that, Level)
#ADDITEM $list %concat($level, " -- ", $name)
}
//Then we pull out some minimalist data for the sake of making our own temporary list.
#PRINT {Memebers of $faction}
#FORALL %sort($list) {#PRINT %i}
//Then display the results
} |
Something like that should work. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Fri Feb 02, 2018 7:47 am |
Soooo far above my skills - Thanks heaps for the replies and the work you did.
I've put the #alias and the #tr in... but they don't really do anything. Nothing is captured to the Wholist window..
The one thing that does happen is it generates an empty Variable named playerList |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Fri Feb 02, 2018 9:58 am |
Okay, I actually opened CMUD and retooled this script to actually work with the example you supplied.
Go ahead and delete the existing settings and use this XML:
Code: |
<class name="Factions" id="9687">
<trigger priority="96850" id="9685">
<pattern>~[{ |}(%d)%s(%x)%s(%x)~]{%s~(PK~)|}{%s~[EMPIRE~]|} (*)</pattern>
<value>#LOCAL $faction
#IF (%match( %line, "(PK)")) {#ADDITEM $faction PK}
#IF (%match( %line, "[EMPIRE]")) {#ADDITEM $faction Empire}
//first we figure out what faction the person is in by testing the line for indicators
$level=%1
$race=%2
$class=%3
$longName=%4
//Then we assign the basic variables, $locally
$name=%item( %replace( %item( %replace( $longName, ", ", "|"), 1), " the ", "|"), 1)
$titles=%replace( %item( %replace( $longName, ", ", "|"), 1), %concat( $name, " the "))
$extraTitles=%item( %replace( $longName, ", ", "|"), 2)
//Then we split up the more complex sections into thier respective variables, feel free to ask more if the logic gets confusing
$this=%db( @playerList, $name)
//Then we pull up the current value from the database... this step could be skipped if you don't need to reference the current values
#ADDKEY $this Titles $titles
#ADDKEY $this Extra $extraTitles
#ADDKEY $this Level $level
#ADDKEY $this Race $race
#ADDKEY $this Class $class
#ADDKEY $this Faction $faction
//Next we update the local variable values
#ADDKEY playerList $name $this
//And then update the main variables
</value>
</trigger>
<alias name="factionSort" id="9688">
<value>#IF (%1) {$faction=%1}
#LOCAL $list
#FORALL %dbkeys( @playerList) {
#IF ($faction) {#IF (!%ismember( $faction, %db( %db( @playerList, %i), Faction))) {#CONTINUE}}
//First we test to see if we are even checking a faction, and if so weather or not the current person is a member of it
$level=%db( %db( @playerList, %i), Level)
#ADDITEM $list %concat( $level, " -- ", %i)
}
//Then we pull out some minimalist data for the sake of making our own temporary list.
#PRINT {Memebers of $faction}
#FORALL %sort( $list, 1) {#PRINT %i}
//Then display the results </value>
<arglist>$faction</arglist>
</alias>
</class>
|
Paste this over any existing text on the XML tab of a new class setting in the GUI |
|
_________________ Discord: Shalimarwildcat |
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Fri Feb 02, 2018 11:01 am |
I feel really really silly right now, but I put that script into the XML of a trigger.. nothing seems to capture or re-sort :S
Sorry, it's maybe something silly I should know about but don't?
Here's another example "wholist"
Code: |
[31 Min War] (PK) Gringe the Master of Offense
[51 W-Elf Ran] Aiya Wanwahina the Author of Thera's Largest Cookbook, High Herald of the Eternal Star
[15 Human Asn] Radarak the Tateken
[51 W-Elf Bar] Ehlonyra n'Suielhir the Grand Mistress of Artistry, Bartender of the Eternal Star
[49 Human Con] Alemius the Channeler of the Spirits
[51 Mummy Nec] [TRIBUNAL] Marideth Annchu the Returned, Provincial Magistrate
[39 W-Elf Bar] (PK) Kalaren the Master of Euphony, Balladeer of the Eternal Star
[15 D-Elf Thi] Sauvigni the Robber
[21 Elf Ran] Zynoh the Howler
[47 Human Nec] (PK) [TRIBUNAL] Carrick the Spectre, Provincial Magistrate
[16 Human A-P] Perritel the Stealer
[37 Human Inv] (PK) Ctozheq the Wizard of Pyrotechniques
[51 Felar War] Leorne the Legend of the Battlefield
[33 Dwarf War] (PK) Thraum the Warrior of the Gauntlet
[25 Elf War] Cerafex the Tactician
*39 Human Asn* (PK) Kaylonn the Master of Nage Waza
[51 H-Drw Asn] Seshaien the Dai Sensei of the Miyama Ryu, Elite Imperial Shadow
Players found: 17 |
|
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Fri Feb 02, 2018 11:02 am |
Getting a few things asking if I want to restart or continue the application when I play around with the pattern too much too.
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Fri Feb 02, 2018 5:38 pm |
Well, i said to put that XML into a class (aka folder), not a trigger, so that might be part of it.
The XML is for the trigger and alias both.
Out of curiosity, what are you trying to add to the pattern? The [TRIBUNAL]? |
|
_________________ Discord: Shalimarwildcat |
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Sat Feb 03, 2018 3:45 am |
Mostly just Empire and Tribunal.
I put the xml into a class folder.. It then creates the trigger and alias automatically.
When I enter 'who' in game, nothing happens!
Sorry to be such a pain!
(what about just a trigger that lists everyone according to level? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Sat Feb 03, 2018 4:44 am |
The trigger will not do anything visually, all it does is populate the database variable.
The alias will display everyone or just the individual factions.
As for the Tribunal.... is there a case where someone is in the empire and in the tribunal, if so which one displays first? |
|
_________________ Discord: Shalimarwildcat |
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Sat Feb 03, 2018 6:48 am |
Only one is every displayed, but to be honest I would rather it ignored Tribunal altogether.
What I'm after would be:
Code: |
[42 Felar Ran] Crashee the Caller of the Pack
[33 Storm War] (PK) Nhorljan the Warrior of the Gauntlet
[28 Fire War] (PK) [EMPIRE] Moebo the Veteran, Sheathed Blade
[46 Human Thi] [EMPIRE] Jiouvesh the Unseen, Imperial Shadow Lord
*30 Arial Asn* (PK) [EMPIRE] Xalsas the Ogoshi, Imperial Shadow
[10 Human Con] Castigan the Scholar of Magic
[51 D-Elf A-P] [EMPIRE] Orzmus Tyroz the Fist of Darkness, Imperial Dread Lord
[15 Storm Pal] Demnas the Esteemed
[51 Felar Asn] Kasic the Dai Sensei of the Miyama Ryu
[34 Dwarf War] (PK) Derigan the Warrior of the Shield
Players found: 10
~~BECOMES SOMETHING LIKE~~
[51 Felar Asn] Kasic the Dai Sensei of the Miyama Ryu
[42 Felar Ran] Crashee the Caller of the Pack
[15 Storm Pal] Demnas the Esteemed
[10 Human Con] Castigan the Scholar of Magic
[51 D-Elf A-P] [EMPIRE] Orzmus Tyroz the Fist of Darkness, Imperial Dread Lord
[46 Human Thi] [EMPIRE] Jiouvesh the Unseen, Imperial Shadow Lord
*30 Arial Asn* (PK) [EMPIRE] Xalsas the Ogoshi, Imperial Shadow
[28 Fire War] (PK) [EMPIRE] Moebo the Veteran, Sheathed Blade
[34 Dwarf War] (PK) Derigan the Warrior of the Shield
[33 Storm War] (PK) Nhorljan the Warrior of the Gauntlet
Players found: 10 |
|
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Sat Feb 03, 2018 1:48 pm |
What if I said - all I want it to do is=
copy my wholist to a new window called "wholist" but put it in level order from highest to lowest?
Thanks! |
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Tue Feb 06, 2018 12:28 pm |
boblinski wrote: |
What if I said - all I want it to do is=
copy my wholist to a new window called "wholist" but put it in level order from highest to lowest?
Thanks! |
Not even any first pointers for this.
The original stuff in this thread is just way too far above my head - when I try to extract what I need, nothing at all makes sense to me! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu Feb 08, 2018 2:24 am |
Sorry, going back to the original trigger, you could try....
#TR {~[{ |}(%d)%s(%x)%s(%x)~]{%s~(PK~)|}{%s~[EMPIRE~]|}{%s~[TRIBUNAL~]|} (*)} {
#GAG
$level=%1
$list=%db(@CurrentlyOn, $level)
#ADDITEM $list %line
#ADDKEY CurrentlyOn $level $list
}
And then to display it:
#TR {Players found:} {#FORALL %sort(%dbkeys(@currentlyOn), 1) {
$list=%db(@currentluOn, %i)
#WIN WhoList {Level %i}
#FORALL $list {#WIN WhoList {%j}}
currentlyOn=""
}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
boblinski Novice
Joined: 05 Dec 2005 Posts: 49 Location: New Zealand
|
Posted: Thu Feb 08, 2018 8:11 am |
Hey! This is working great so far, and as you can see I've changed it a little bit to get it to work with a single digit and double in my pattern. Here's what I've got, couple of questions at the bottom:
Code: |
#TR {Players found:%s(%d)} {
#FORALL %sort(%dbkeys(@currentlyOn), 0) {
$list=%db(@currentlyOn, %i)
#WIN WhoList {Level %i}
#FORALL $list {#WIN WhoList {%j}}
}
#WIN WhoList Players found: %1
PreOn = @NowOn
CurrentlyOn = %null
NowOn = %null
}
#TR {{~[|~*}{ |}(%d)%s(%x)%s(%x){~]|~*}{%s~(PK~)|}{%s~[EMPIRE~]|}{%s~[TRIBUNAL~]|}{%s~(WANTED~)|} (%x) (*)} {
$level={%if(%1 <10,0%1,%1)}
$list=%db(@CurrentlyOn, $level)
#ADDITEM $list %line
#ADDKEY CurrentlyOn $level $list
#additem NowOn %4
} |
As you can see I've added something where it will not record just the first name of each player onto @NowOn, and then record that onto @PreOn. I've also made it so it clears both CurrentlyOn and NowOn to %null when the whole thing ends.
My question now is:
What can I do to compare both...
NowOn vs PreOn
PreOn vs NowOn
I know this is way off, and haven't managed to get anything working at all... but basically ->
#if {@NowOn =! @PreOn} {NEWly logged on player list}
#if {@PreOn =! @NowOn} {Logged OFF list}
Ideally it would just say, maybe under my "Players Found:" something like..
Players ON: Bob, Shal, Gary
Players OFF: - |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu Feb 08, 2018 11:28 pm |
#LOCAL $newOn $off
#FORALL @nowOn {#IF (!%ismember(%i, @preOn)) {#ADDITEM $newOn %i}}
#PRINT {Players On: %expandlist($newOn, ", ")}
And flip the logic accordingly to populate $off
You might also want to change @preOn to $preOn, unless it is used outside of this setting. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|
|
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
|
|