Difference between revisions of "Get ccs action"

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
m (Format-fixing.)
imported>Bale
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=In-combat Consulting|
 
  
 
function1={{Function|
 
function1={{Function|
Line 16: Line 15:
 
}}|
 
}}|
  
function_description=This function will return the [[Custom Combat Script|CCS]] command for a given round in the current combat. This will use the section of the CCS for the monster that is currently being fought. See [[adventure]]() for more details.|
+
function_description=This function will read a line from the active [[Custom Combat Script|CCS]] for a given round and return that round's command as a string. This will only return a value from the section of the [[Custom Combat Script|CCS]] for the monster that is currently being fought. Note that this command is only useful in consult scripts or combat filters. See {{f|adventure}} for more details.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|
Line 23: Line 22:
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
string run_combat(int round, string opp, string text) {
+
string run_combat(int round, monster opp, string text) {
 
   return get_ccs_action(round);
 
   return get_ccs_action(round);
 
}
 
}
 
</syntaxhighlight>}}
 
</syntaxhighlight>}}
 
{{CodeSample|
 
{{CodeSample|
description=This is a function designed for use in a combat consult script that has parameters contained in a note field of the CCS.|
+
description=This is a function designed for use in a combat consult script that has parameters contained in a note field of the CCS. (A note is just a comment that contains information.)|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 40: Line 39:
 
</syntaxhighlight>}}|
 
</syntaxhighlight>}}|
  
see_also={{SeeAlso|adventure|adv1}}|
+
see_also={{SeeAlso|adventure|adv1|run_combat}}|
 
}}
 
}}
{{RFI|I've seen references to the note field of a CCS before, but don't understand how it needs to be formatted:|Is it included in each monster / location spec?|Is it off on its own somewhere in the CCS?|Does it need to have each line prefixed with "note:" or something?}}
+
 
 +
[[Category:In-combat Consulting]]

Latest revision as of 10:00, 6 December 2016

Function Syntax

string get_ccs_action(int round )

  • round is the current round of combat

This function will read a line from the active CCS for a given round and return that round's command as a string. This will only return a value from the section of the CCS for the monster that is currently being fought. Note that this command is only useful in consult scripts or combat filters. See adventure() for more details.

Code Sample

This incredibly basic combat filter will simply do exactly what the CCS instructs.

string run_combat(int round, monster opp, string text) {
   return get_ccs_action(round);
}

This is a function designed for use in a combat consult script that has parameters contained in a note field of the CCS. (A note is just a comment that contains information.)

string get_parameter() {
   for i from 0 upto 30 {
      ccs_line =  get_ccs_action(i).to_lower_case();
      if(ccs_line.substring(0, 5) == "note ")
         return get_ccs_action(i).to_lower_case();
   }
}

See Also

adventure() | adv1() | run_combat()