Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
JRSteensen
Beginner


Joined: 27 Jul 2004
Posts: 25

PostPosted: Tue Apr 25, 2017 12:13 pm   

Optional trigger state?
 
Currently, I have multiple trigger states to capture various gauges to track certain stats.

The third state in the following appears sometimes, otherwise it doesn't appear in input. If it doesn't exist, it should zeroize the relevant variables. ("Sometimes" state indicated by carrots.)

Code:

<trigger name="TBattlegroupStatus1" param="1" priority="3020" id="2938">
  <pattern>~[(*)~] (%w)*:(*) '(*)'*--</pattern>
  <value>LastPos = %1
#SWITCH (@LastPos = " L ") {FlagName = %4} (@LastPos = 001) {Wing1Name = %4} (@LastPos = 002) {Wing2Name = %4}
#SWITCH (@LastPos = " L ") {FlagPos = %5} (@LastPos = 001) {Wing1Pos = %5} (@LastPos = 002) {Wing2Pos = %5}</value>
>>>  <trigger name="TBattlegroupStatus3">
    <pattern>Targetting: *:(*) (%d)~%|(%d)~%</pattern>
    <value>#SWITCH (@LastPos = " L ") {FlagTarget = %1} (@LastPos = 001) {Wing1Target = %1} (@LastPos = 002) {Wing2Target = %1}
#SWITCH (@LastPos = " L ") {FlagTarget = %2} (@LastPos = 001) {Wing1Target = %2} (@LastPos = 002) {Wing2Target = %2}
#SWITCH (@LastPos = " L ") {FlagTarget = %3} (@LastPos = 001) {Wing1Target = %3} (@LastPos = 002) {Wing2Target = %3}</value>
  </trigger>[/b]
  <trigger name="TBattlegroupStatus2">
    <pattern>Energy: (%d)~%~|Hull: (%d)~%~|Crew: (%d)~|System: (*) (%f)/(%f)</pattern>
    <value>#SWITCH (@LastPos = " L ") {FlagEnergy = %1} (@LastPos = 001) {Wing1Energy = %1} (@LastPos = 002) {Wing2Energy = %1}
#SWITCH (@LastPos = " L ") {FlagHull = %2} (@LastPos = 001) {Wing1Hull = %2} (@LastPos = 002) {Wing2Hull = %2}
#SWITCH (@LastPos = " L ") {FlagCrew = %3} (@LastPos = 001) {Wing1Crew = %3} (@LastPos = 002) {Wing2Crew = %3}
#SWITCH (@LastPos = " L ") {FlagSystem = %4} (@LastPos = 001) {Wing1System = %4} (@LastPos = 002) {Wing2System = %4}
#SWITCH (@LastPos = " L ") {FlagX = %5} (@LastPos = 001) {Wing1X = %5} (@LastPos = 002) {Wing2X = %5}
#SWITCH (@LastPos = " L ") {FlagY = %6} (@LastPos = 001) {Wing1Y = %6} (@LastPos = 002) {Wing2Y = %6}</value>
  </trigger>
</trigger>


Here is the pattern with the target line:

Code:

[001] Battleship   :Imperial Star Destroyer 'Ravina'    -<Pos:Midguard>-
 Energy: 099%|Hull: 100%|Crew: 000|System: Corusca Sector 0/0
    Targetting: Transport:Heavy Pirate Starfighter 'Lucky Gambit' 099%|100%
[002] Battleship   :Imperial Star Destroyer 'Resolute'  -<Pos:Outer>-
 Energy: 100%|Hull: 100%|Crew: 000|System: Alderaan System 40/-30


Here is the one without the target line:

Code:

[001] Battleship   :Imperial Star Destroyer 'Ravina'    -<Pos:Midguard>-
 Energy: 099%|Hull: 100%|Crew: 000|System: Corusca Sector 0/0
[002] Battleship   :Imperial Star Destroyer 'Resolute'  -<Pos:Outer>-
 Energy: 100%|Hull: 100%|Crew: 000|System: Alderaan System 40/-30


Been scratching my head on this one all evening.
Reply with quote
mikeC130
Wanderer


Joined: 03 Jul 2006
Posts: 63

PostPosted: Tue Apr 25, 2017 10:01 pm   
 
I believe that a multistate trigger will do what you are looking for, using the "within" parameter (you could do the entire thing with a multistate trigger rather than requiring separate triggers). Set the appropriate variables to zero in what is now the second trigger, and then add a condition for the targeting line which sets those variables if it is received.

Mike
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net