Script: Count

From Ultima Online: The Second Age
Revision as of 23:45, 5 October 2018 by Grimoric (talk | contribs) (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...")
(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);
}