Difference between revisions of "Script: Count"
From Ultima Online: The Second Age
(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...") |
|||
Line 5: | Line 5: | ||
<span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"targetVal"</span>)) | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"targetVal"</span>)) | ||
{ | { | ||
− | targetVal = [[ | + | targetVal = [[Engine_Function:_getobjvar_int|<span style="color:#FF0000;font-weight:bold">getobjvar_int</span>]](this, <span style="color:#800000">"targetVal"</span>); |
} | } | ||
<span style="color:#0000FF">else</span> | <span style="color:#0000FF">else</span> | ||
Line 19: | Line 19: | ||
<span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, s)) | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, s)) | ||
{ | { | ||
− | val = [[ | + | val = [[Engine_Function:_getobjvar_int|<span style="color:#FF0000;font-weight:bold">getobjvar_int</span>]](this, s); |
Q63R = Q63R + val; | Q63R = Q63R + val; | ||
} | } |
Latest revision as of 02:44, 21 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); }