Difference between revisions of "Script: Tracking"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">inherits</span> sk_table; <span style="color:#0000FF">member</span> <span style="color:#0000FF">list</span> Q5FB; forward <span style="col...")
 
 
Line 3: Line 3:
 
  <span style="color:#0000FF">member</span> <span style="color:#0000FF">list</span> Q5FB;
 
  <span style="color:#0000FF">member</span> <span style="color:#0000FF">list</span> Q5FB;
  
  forward <span style="color:#0000FF">void</span> [[cleanup|<span style="color:#2B91AF">cleanup</span>]]();
+
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]]();
 
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Q4RJ|<span style="color:#2B91AF">Q4RJ</span>]](<span style="color:#0000FF">string</span> , <span style="color:#0000FF">loc</span> , <span style="color:#0000FF">loc</span> );
 
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Q4RJ|<span style="color:#2B91AF">Q4RJ</span>]](<span style="color:#0000FF">string</span> , <span style="color:#0000FF">loc</span> , <span style="color:#0000FF">loc</span> );
  
Line 35: Line 35:
 
   <span style="color:#0000FF">list</span> Q643 = 0x2122, <span style="color:#800000">"Animals"</span>, 0x20D8, <span style="color:#800000">"Creatures"</span>, 0x2106, <span style="color:#800000">"People"</span>;
 
   <span style="color:#0000FF">list</span> Q643 = 0x2122, <span style="color:#800000">"Animals"</span>, 0x20D8, <span style="color:#800000">"Creatures"</span>, 0x2106, <span style="color:#800000">"People"</span>;
 
   [[Engine Function:_selectType|<span style="color:#FF0000;font-weight:bold">selectType</span>]](this, this, 0x25, <span style="color:#800000">"What do you wish to track?"</span>, Q643);
 
   [[Engine Function:_selectType|<span style="color:#FF0000;font-weight:bold">selectType</span>]](this, this, 0x25, <span style="color:#800000">"What do you wish to track?"</span>, Q643);
   [[cleanup|<span style="color:#2B91AF">cleanup</span>]]();
+
   [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]]();
 
   <span style="color:#0000FF">return</span> (0x00);
 
   <span style="color:#0000FF">return</span> (0x00);
 
  }
 
  }
Line 50: Line 50:
 
   {
 
   {
 
     debugMessage(<span style="color:#800000">"Selecttype aborted"</span>);
 
     debugMessage(<span style="color:#800000">"Selecttype aborted"</span>);
     [[cleanup|<span style="color:#2B91AF">cleanup</span>]]();
+
     [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]]();
 
     <span style="color:#0000FF">return</span> (0x00);
 
     <span style="color:#0000FF">return</span> (0x00);
 
   }
 
   }

Latest revision as of 08:34, 19 October 2018

inherits sk_table;
member list Q5FB;
forward void cleanup();
forward void Q4RJ(string , loc , loc );
trigger message("canUseSkill")
{
  return (0x00);
}
trigger callback(0x4D)
{
  detachScript(this, "tracking");
  return (0x00);
}
trigger message("useSkill")
{
  clearList(Q5FB);
  callback(this, 0x0A, 0x4D);
  int Q4Q1;
  Q4Q1 = testSkill(this, 0x26);
  int Q5TE = getSkillLevel(this, 0x26);
  if (Q5TE == 0x00)
  {
    systemMessage(this, "Tracking failed.");
    return (0x00);
  }
  loc Q66U = getLocation(this);
  loc Q469;
  list Q57U;
  int Q61W;
  list Q643 = 0x2122, "Animals", 0x20D8, "Creatures", 0x2106, "People";
  selectType(this, this, 0x25, "What do you wish to track?", Q643);
  cleanup();
  return (0x00);
}
trigger typeselected(0x25)
{
  trackingTypeSelected(Q5FB, this, listindex, objtype, getLocation(this));
  return (0x00);
}
trigger typeselected(0x29)
{
  if (listindex == 0x00)
  {
    debugMessage("Selecttype aborted");
    cleanup();
    return (0x00);
  }
  if (0x00)
  {
    printList(Q5FB);
    obj Q4XN;
    string Q5WR;
    for(int i = 0x00; i < numInList(Q5FB); i++)
    {
      Q4XN = Q5FB[i];
      Q5WR = objToStr(Q4XN);
      debugMessage("" + Q5WR + " " + getObjType(Q4XN) + " " + getName(Q4XN));
    }
    debugMessage("listindex = " + (listindex - 0x01));
    debugMessage("yes, I put it up after adding the clearlist");
  }
  obj trackee = Q5FB[listindex - 0x01];
  attachscript(this, "useristracking");
  setObjVar(this, "trackee", trackee);
  callback(this, 0x01, 0x50);
  callback(this, 0x96, 0x51);
  return (0x00);
}
function void cleanup()
{
  clearList(Q5FB);
  if (hasScript(this, "useristracking"))
  {
    shortCallback(this, 0x01, 0x51);
  }
  return ();
}
function void Q4RJ(string description, loc Q4VS, loc there)
{
  int Q4IE = getDirectionInternal(Q4VS, there);
  switch (Q4IE)
  {
  case 0x00
    description = description + "to the North.";
    break;
  case 0x01
    description = description + "to the Northeast.";
    break;
  case 0x02
    description = description + "to the East.";
    break;
  case 0x03
    description = description + "to the Southeast.";
    break;
  case 0x04
    description = description + "to the South.";
    break;
  case 0x05
    description = description + "to the Southwest.";
    break;
  case 0x06
    description = description + "to the West.";
    break;
  case 0x07
    description = description + "to the Northwest.";
    break;
  default
    debugMessage("getDirection: invalid direction returned.");
    description = description + " in some direction.";
    break;
  }
  return ();
}