Difference between revisions of "Script: Lock it"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">inherits</span> globals; <span style="color:#0000FF">member</span> <span style="color:#0000FF">int</span> lockLevel; <span style="color:#0...")
 
Line 32: Line 32:
 
   <span style="color:#0000FF">return</span> ();
 
   <span style="color:#0000FF">return</span> ();
 
  }
 
  }
 +
 +
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> lock_it(<span style="color:#0000FF">obj</span> Q4XN, <span style="color:#0000FF">int</span> start, <span style="color:#0000FF">int</span> stop)
 +
  {
 +
    <span style="color:#0000FF">if</span> (![[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q4XN, <span style="color:#800000">"isLocked"</span>))
 +
    {
 +
      [[Engine Function:_attachScript|<span style="color:#FF0000;font-weight:bold">attachScript</span>]](Q4XN, <span style="color:#800000">"locked"</span>);
 +
      lockLevel = [[Engine Function:_random|<span style="color:#FF0000;font-weight:bold">random</span>]](start, stop);
 +
      [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q4XN, <span style="color:#800000">"isLocked"</span>, lockLevel);
 +
      [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q4XN, <span style="color:#800000">"lockLevel"</span>, lockLevel);
 +
      <span style="color:#0000FF">return</span> (0x01);
 +
    }
 +
    <span style="color:#0000FF">return</span> (0x00);
 +
  }

Revision as of 05:17, 12 October 2018

inherits globals;
member int lockLevel;
function int lock_it(obj Q4XN, int start, int stop)
{
  if (!hasObjVar(Q4XN, "isLocked"))
  {
    attachScript(Q4XN, "locked");
    lockLevel = random(start, stop);
    setObjVar(Q4XN, "isLocked", lockLevel);
    setObjVar(Q4XN, "lockLevel", lockLevel);
    return (0x01);
  }
  return (0x00);
}
function int Q53O(obj Q4XN, int start, int stop)
{
  lockLevel = random(start, stop);
  setObjVar(Q4XN, "lockLevel", lockLevel);
  return (0x01);
}
function void Q53P(obj Q4XN)
{
  if (!hasObjVar(Q4XN, "isLocked"))
  {
    int Q53R = getObjVar(Q4XN, "lockLevel");
    setObjVar(Q4XN, "isLocked", Q53R);
  }
  return ();
}
 function int lock_it(obj Q4XN, int start, int stop)
 {
   if (!hasObjVar(Q4XN, "isLocked"))
   {
     attachScript(Q4XN, "locked");
     lockLevel = random(start, stop);
     setObjVar(Q4XN, "isLocked", lockLevel);
     setObjVar(Q4XN, "lockLevel", lockLevel);
     return (0x01);
   }
   return (0x00);
 }