Difference between revisions of "Script: Count"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">trigger</span> message(<span style="color:#800000">"activate"</span>) { <span style="color:#0000FF">int</span> Q63R = 0x00; <span style="co...")
(No difference)

Revision as of 00:45, 6 October 2018

trigger message("activate")
{
  int Q63R = 0x00;
  int targetVal;
  if (hasObjVar(this, "targetVal"))
  {
    targetVal = getobjvar_int(this, "targetVal");
  }
  else
  {
    bark(this, "Must have a target value!");
  }
  int val;
  for(int Q4OL = 0x00; Q4OL < 0x08; Q4OL++)
  {
    string c;
    assignstrint(c, Q4OL);
    string s = "val" + c;
    if (hasObjVar(this, s))
    {
      val = getobjvar_int(this, s);
      Q63R = Q63R + val;
    }
  }
  if (Q63R == targetVal)
  {
    processTriggerCmds(this, "a");
  }
  else
  {
    processTriggerCmds(this, "d");
  }
  return (0x00);
}