Difference between revisions of "Suggestion: csv output of battle stats"

From Flexible Survival
Jump to: navigation, search
(Solution)
(Overview)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
This is a suggestion/request of sorts. The intention is to allow players to parse battle output.
+
= Overview =
 +
This is a suggestion/request of sorts. The intention is to allow players to parse battle output more reliably.
  
 
Currently there are two methods that I am aware of to determine the health and energy of players and ferals: hp and fprompt.
 
Currently there are two methods that I am aware of to determine the health and energy of players and ferals: hp and fprompt.
  
hp outputs a table of coloured bars which is a good visual aid and isn't terribly difficult to parse in MUSHClient or tintin++. fprompt outputs a much leaner version of this content that is easier to parse but is less immediately interpretable. My solution to parsing fprompt is to use the following triggers:
+
hp outputs a table of coloured bars which is a good visual aid. fprompt outputs a much leaner version of this content that is easier to parse but is less immediately interpretable by eye. My current solution to parsing fprompt is to capture each line, format it then add it to an array.
 
+
<br>
<pre>
+
Here's my output as an example, the battle stats are in the top, right pane:
#nop {==================================================================}
+
[[File:Screenshot_2015-08-13_13-00-12.png|900px]]
#nop {grab player stats from fprompt and pass to python for logging.}
 
#nop {==================================================================}
 
#act {^Pet: %6      <%7/%8 hp - %9/%10 en>} {
 
    #var feral_name %6;
 
    #var feral_hp %7;
 
    #var feral_maxhp %8;
 
    #var feral_en %9;
 
    #var feral_max_en %10;
 
    #py fs.stats_output("1", "$feral_name", "$feral_hp", "$feral_maxhp", "$feral_en", "$feral_max_en")
 
} {5}
 
#act {%5. %6      <%7/%8 hp - %9/%10 en>} {
 
    #var feral_num %5;
 
    #var feral_name %6;
 
    #var feral_hp %7;
 
    #var feral_maxhp %8;
 
    #var feral_en %9;
 
    #var feral_max_en %10;
 
    #py fs.stats_output("$feral_num", "$feral_name", "$feral_hp", "$feral_maxhp", "$feral_en", "$feral_max_en")
 
}
 
#act {%6      <%7/%8 hp - %9/%10 en>} {
 
    #var plyr_name %6;
 
    #var plyr_hp %7;
 
    #var plyr_maxhp %8;
 
    #var plyr_en %9;
 
    #var plyr_max_en %10;
 
    #py fs.stats_output("0", "$plyr_name", "$plyr_hp", "$plyr_maxhp", "$plyr_en", "$plyr_max_en")
 
} {6}
 
#act {^<ENDLIST>} {#py fs.stats_output("99", "0", "0", "0", "0", "0")}
 
</pre>
 
 
 
Thus, each line of fprompt is captured and categorised until <ENDLIST> is detected, the lines are then formatted and outputted to the screen. Here's my output as an example, the battle stats are in the top, right pane:
 
[[File:Screenshot_2015-08-13_13-00-12.png]]
 
  
  
Line 50: Line 19:
 
== Solution ==
 
== Solution ==
 
A single comma-seperated value (CSV) line. e.g.
 
A single comma-seperated value (CSV) line. e.g.
ENEMIES,rgb,13. Bouncy Half-Gryphon Bartender 12302/13886 72/100,rgb,12. Accelerated Half-Dragon Stripper 13457/13585 93/100,rgb,11. Half-Dragon Stripper Caregiver 13099/13585 89/100,ENEMYPETS,PLAYERS,rgb,Aluthal 11713/12091 100/100,rgb,Anwen 11519/11519 28/98,rgb,Hope 14557/14557 49/92,PETS,rgb,GRIND(Anwen) 8798/8798 54/106, rgb,Nina(Hope) 11607/11607 129/150,THINGS,rgb,Tactics Soldier(!) 0/104 100/100,rgb,Pheromone Technician(!) 0/104 100/100,rgb,Terminal 0/104 -140/100,END
+
<br>
 +
ENEMIES,rgb,13. Bouncy Half-Gryphon Bartender 12302/13886 72/100,ENEMYPETS,rgb,Pet 1: Blah 11607/11607 129/150,PLAYERS,rgb,Anwen 11519/11519 28/98,PETS,rgb,GRIND(Anwen) 8798/8798 54/106,THINGS,rgb,Tactics Soldier(!) 0/104 100/100,END
  
 
where rgb is the applicable colour value.
 
where rgb is the applicable colour value.
  
 
Breakdown of sections:
 
Breakdown of sections:
 +
<pre>
 
ENEMIES,rgb,13. Bouncy Half-Gryphon Bartender 12302/13886 72/100,...
 
ENEMIES,rgb,13. Bouncy Half-Gryphon Bartender 12302/13886 72/100,...
 
ENEMYPETS,rgb,Pet 1: Blah 11607/11607 129/150,...
 
ENEMYPETS,rgb,Pet 1: Blah 11607/11607 129/150,...
Line 61: Line 32:
 
THINGS,rgb,Tactics Soldier(!) 0/104 100/100,...
 
THINGS,rgb,Tactics Soldier(!) 0/104 100/100,...
 
END
 
END
 +
</pre>
  
 
== Summary ==
 
== Summary ==
 
CSV is trivial to parse, the output would be unambiguous and there is no fear of missed lines (either it's there or it isn't!). Section names (ENEMIES, THINGS) could be shortened if necessary.
 
CSV is trivial to parse, the output would be unambiguous and there is no fear of missed lines (either it's there or it isn't!). Section names (ENEMIES, THINGS) could be shortened if necessary.

Latest revision as of 23:12, 16 August 2015

Overview

This is a suggestion/request of sorts. The intention is to allow players to parse battle output more reliably.

Currently there are two methods that I am aware of to determine the health and energy of players and ferals: hp and fprompt.

hp outputs a table of coloured bars which is a good visual aid. fprompt outputs a much leaner version of this content that is easier to parse but is less immediately interpretable by eye. My current solution to parsing fprompt is to capture each line, format it then add it to an array.
Here's my output as an example, the battle stats are in the top, right pane: 900px


This works most of the time but there are two issues that make it unreliable and inconvenient.

1. Sometimes a line gets garbled and thus it is missed resulting in incomplete status. 2. Some ferals (Primes, backups, others) do not have a number and period at the start of the string which makes them harder to categorise. They can, of course, be categorised by looking for "Prime" and "backup" in the name but this leaves the (admittedly unlikely) possibility that a player may choose a name with one of these strings in it at some future point.


Solution

A single comma-seperated value (CSV) line. e.g.
ENEMIES,rgb,13. Bouncy Half-Gryphon Bartender 12302/13886 72/100,ENEMYPETS,rgb,Pet 1: Blah 11607/11607 129/150,PLAYERS,rgb,Anwen 11519/11519 28/98,PETS,rgb,GRIND(Anwen) 8798/8798 54/106,THINGS,rgb,Tactics Soldier(!) 0/104 100/100,END

where rgb is the applicable colour value.

Breakdown of sections:

ENEMIES,rgb,13. Bouncy Half-Gryphon Bartender 12302/13886 72/100,...
ENEMYPETS,rgb,Pet 1: Blah 11607/11607 129/150,...
PLAYERS,rgb,Aluthal 11713/12091 100/100,...
PETS,rgb,GRIND(Anwen) 8798/8798 54/106,...
THINGS,rgb,Tactics Soldier(!) 0/104 100/100,...
END

Summary

CSV is trivial to parse, the output would be unambiguous and there is no fear of missed lines (either it's there or it isn't!). Section names (ENEMIES, THINGS) could be shortened if necessary.