Script: Count

From Ultima Online: The Second Age
Revision as of 02:44, 21 October 2018 by Grimoric (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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);
}