Difference between revisions of "Script Function: Q4C4"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4C4(<span style="color:#0000FF">obj</span> this, <span style="color:#0000FF">obj</span> s...")
 
 
Line 1: Line 1:
 +
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4C4(<span style="color:#0000FF">obj</span> this, <span style="color:#0000FF">obj</span> speaker, <span style="color:#0000FF">string</span> arg)
 +
  {
 +
    <span style="color:#0000FF">list</span> args;
 +
    [[Engine Function:_split|<span style="color:#FF0000;font-weight:bold">split</span>]](args, arg);
 +
    <span style="color:#0000FF">if</span> ([[Engine Function:_isInList|<span style="color:#FF0000;font-weight:bold">isInList</span>]](args, <span style="color:#800000">"time"</span>))
 +
    {
 +
      <span style="color:#0000FF">string</span> Q613;
 +
      <span style="color:#0000FF">int</span> Q60B;
 +
      <span style="color:#0000FF">string</span> Q4WP;
 +
      <span style="color:#0000FF">int</span> Q60I;
 +
      <span style="color:#0000FF">string</span> Q57B;
 +
      <span style="color:#0000FF">int</span> Q45A = 0x00;
 +
      Q60I = [[Engine Function:_getMinute|<span style="color:#FF0000;font-weight:bold">getMinute</span>]]();
 +
      Q60B = [[Engine Function:_getHour|<span style="color:#FF0000;font-weight:bold">getHour</span>]]();
 +
      Q60I = Q60I / 0x05;
 +
      <span style="color:#0000FF">switch</span> (Q60I)
 +
      {
 +
      <span style="color:#0000FF">case</span> 0x00
 +
        Q57B = <span style="color:#800000">""</span>;
 +
        Q45A = 0x01;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x01
 +
        Q57B = <span style="color:#800000">"a few minutes past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x02
 +
        Q57B = <span style="color:#800000">"ten past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x03
 +
        Q57B = <span style="color:#800000">"quarter past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x04
 +
        Q57B = <span style="color:#800000">"twenty minutes past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x05
 +
        Q57B = <span style="color:#800000">"a few minutes shy of half-past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x06
 +
        Q57B = <span style="color:#800000">"half-past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x07
 +
        Q57B = <span style="color:#800000">"just over half-past"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x08
 +
        Q57B = <span style="color:#800000">"lacking twenty minutes until"</span>;
 +
        Q60B = Q60B + 0x01;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x09
 +
        Q57B = <span style="color:#800000">"quarter of"</span>;
 +
        Q60B = Q60B + 0x01;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x0A
 +
        Q57B = <span style="color:#800000">"ten of"</span>;
 +
        Q60B = Q60B + 0x01;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x0B
 +
        Q57B = <span style="color:#800000">"almost"</span>;
 +
        Q60B = Q60B + 0x01;
 +
        Q45A = 0x01;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x0C
 +
        Q57B = <span style="color:#800000">""</span>;
 +
        Q45A = 0x01;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">default</span>
 +
        Q57B = <span style="color:#800000">"no known minutes!"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      }
 +
      <span style="color:#0000FF">if</span> (Q60B > 0x17)
 +
      {
 +
        Q60B = 0x00;
 +
      }
 +
      <span style="color:#0000FF">switch</span> (Q60B)
 +
      {
 +
      <span style="color:#0000FF">default</span>
 +
        Q4WP = <span style="color:#800000">"no known hour!"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x00
 +
        Q4WP = <span style="color:#800000">"midnight"</span>;
 +
        Q45A = 0x00;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x0C
 +
        Q4WP = <span style="color:#800000">"noon"</span>;
 +
        Q45A = 0x00;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x01
 +
      <span style="color:#0000FF">case</span> 0x0D
 +
        Q4WP = <span style="color:#800000">"one"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x02
 +
      <span style="color:#0000FF">case</span> 0x0E
 +
        Q4WP = <span style="color:#800000">"two"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x03
 +
      <span style="color:#0000FF">case</span> 0x0F
 +
        Q4WP = <span style="color:#800000">"three"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x04
 +
      <span style="color:#0000FF">case</span> 0x10
 +
        Q4WP = <span style="color:#800000">"four"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x05
 +
      <span style="color:#0000FF">case</span> 0x11
 +
        Q4WP = <span style="color:#800000">"five"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x06
 +
      <span style="color:#0000FF">case</span> 0x12
 +
        Q4WP = <span style="color:#800000">"six"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x07
 +
      <span style="color:#0000FF">case</span> 0x13
 +
        Q4WP = <span style="color:#800000">"seven"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x08
 +
      <span style="color:#0000FF">case</span> 0x14
 +
        Q4WP = <span style="color:#800000">"eight"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x09
 +
      <span style="color:#0000FF">case</span> 0x15
 +
        Q4WP = <span style="color:#800000">"nine"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x0A
 +
      <span style="color:#0000FF">case</span> 0x16
 +
        Q4WP = <span style="color:#800000">"ten"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      <span style="color:#0000FF">case</span> 0x0B
 +
      <span style="color:#0000FF">case</span> 0x17
 +
        Q4WP = <span style="color:#800000">"eleven"</span>;
 +
        <span style="color:#0000FF">break</span>;
 +
      }
 +
      <span style="color:#0000FF">if</span> (Q45A)
 +
      {
 +
        Q4WP = Q4WP + <span style="color:#800000">" o'clock"</span>;
 +
      }
 +
      <span style="color:#0000FF">if</span> ((Q60B > 0x00) && (Q60B < 0x0B))
 +
      {
 +
        Q4WP = Q4WP + <span style="color:#800000">" in the morning"</span>;
 +
      }
 +
      <span style="color:#0000FF">if</span> ((Q60B > 0x0C) && (Q60B < 0x15))
 +
      {
 +
        Q4WP = Q4WP + <span style="color:#800000">" in the afternoon"</span>;
 +
      }
 +
      <span style="color:#0000FF">if</span> (Q60B > 0x14)
 +
      {
 +
        Q4WP = Q4WP + <span style="color:#800000">" at night"</span>;
 +
      }
 +
      Q613 = <span style="color:#800000">"It is "</span> + Q57B + <span style="color:#800000">" "</span> + Q4WP + <span style="color:#800000">"."</span>;
 +
      [[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]](this, Q613);
 +
      [[Script_Function:_Q4J9|<span style="color:#2B91AF">Q4J9</span>]](this);
 +
      <span style="color:#0000FF">return</span> (0x00);
 +
    }
 +
    <span style="color:#0000FF">return</span> (0x01);
 +
  }
 +
 
   <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4C4(<span style="color:#0000FF">obj</span> this, <span style="color:#0000FF">obj</span> speaker, <span style="color:#0000FF">string</span> arg)
 
   <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4C4(<span style="color:#0000FF">obj</span> this, <span style="color:#0000FF">obj</span> speaker, <span style="color:#0000FF">string</span> arg)
 
   {
 
   {

Latest revision as of 14:42, 12 October 2018

 function int Q4C4(obj this, obj speaker, string arg)
 {
   list args;
   split(args, arg);
   if (isInList(args, "time"))
   {
     string Q613;
     int Q60B;
     string Q4WP;
     int Q60I;
     string Q57B;
     int Q45A = 0x00;
     Q60I = getMinute();
     Q60B = getHour();
     Q60I = Q60I / 0x05;
     switch (Q60I)
     {
     case 0x00
       Q57B = "";
       Q45A = 0x01;
       break;
     case 0x01
       Q57B = "a few minutes past";
       break;
     case 0x02
       Q57B = "ten past";
       break;
     case 0x03
       Q57B = "quarter past";
       break;
     case 0x04
       Q57B = "twenty minutes past";
       break;
     case 0x05
       Q57B = "a few minutes shy of half-past";
       break;
     case 0x06
       Q57B = "half-past";
       break;
     case 0x07
       Q57B = "just over half-past";
       break;
     case 0x08
       Q57B = "lacking twenty minutes until";
       Q60B = Q60B + 0x01;
       break;
     case 0x09
       Q57B = "quarter of";
       Q60B = Q60B + 0x01;
       break;
     case 0x0A
       Q57B = "ten of";
       Q60B = Q60B + 0x01;
       break;
     case 0x0B
       Q57B = "almost";
       Q60B = Q60B + 0x01;
       Q45A = 0x01;
       break;
     case 0x0C
       Q57B = "";
       Q45A = 0x01;
       break;
     default
       Q57B = "no known minutes!";
       break;
     }
     if (Q60B > 0x17)
     {
       Q60B = 0x00;
     }
     switch (Q60B)
     {
     default
       Q4WP = "no known hour!";
       break;
     case 0x00
       Q4WP = "midnight";
       Q45A = 0x00;
       break;
     case 0x0C
       Q4WP = "noon";
       Q45A = 0x00;
       break;
     case 0x01
     case 0x0D
       Q4WP = "one";
       break;
     case 0x02
     case 0x0E
       Q4WP = "two";
       break;
     case 0x03
     case 0x0F
       Q4WP = "three";
       break;
     case 0x04
     case 0x10
       Q4WP = "four";
       break;
     case 0x05
     case 0x11
       Q4WP = "five";
       break;
     case 0x06
     case 0x12
       Q4WP = "six";
       break;
     case 0x07
     case 0x13
       Q4WP = "seven";
       break;
     case 0x08
     case 0x14
       Q4WP = "eight";
       break;
     case 0x09
     case 0x15
       Q4WP = "nine";
       break;
     case 0x0A
     case 0x16
       Q4WP = "ten";
       break;
     case 0x0B
     case 0x17
       Q4WP = "eleven";
       break;
     }
     if (Q45A)
     {
       Q4WP = Q4WP + " o'clock";
     }
     if ((Q60B > 0x00) && (Q60B < 0x0B))
     {
       Q4WP = Q4WP + " in the morning";
     }
     if ((Q60B > 0x0C) && (Q60B < 0x15))
     {
       Q4WP = Q4WP + " in the afternoon";
     }
     if (Q60B > 0x14)
     {
       Q4WP = Q4WP + " at night";
     }
     Q613 = "It is " + Q57B + " " + Q4WP + ".";
     bark(this, Q613);
     Q4J9(this);
     return (0x00);
   }
   return (0x01);
 }
 function int Q4C4(obj this, obj speaker, string arg)
 {
   list args;
   split(args, arg);
   if (isInList(args, "time"))
   {
     string Q613;
     int Q60B;
     string Q4WP;
     int Q60I;
     string Q57B;
     int Q45A = 0x00;
     Q60I = getMinute();
     Q60B = getHour();
     Q60I = Q60I / 0x05;
     switch (Q60I)
     {
     case 0x00
       Q57B = "";
       Q45A = 0x01;
       break;
     case 0x01
       Q57B = "a few minutes past";
       break;
     case 0x02
       Q57B = "ten past";
       break;
     case 0x03
       Q57B = "quarter past";
       break;
     case 0x04
       Q57B = "twenty minutes past";
       break;
     case 0x05
       Q57B = "a few minutes shy of half-past";
       break;
     case 0x06
       Q57B = "half-past";
       break;
     case 0x07
       Q57B = "just over half-past";
       break;
     case 0x08
       Q57B = "lacking twenty minutes until";
       Q60B = Q60B + 0x01;
       break;
     case 0x09
       Q57B = "quarter of";
       Q60B = Q60B + 0x01;
       break;
     case 0x0A
       Q57B = "ten of";
       Q60B = Q60B + 0x01;
       break;
     case 0x0B
       Q57B = "almost";
       Q60B = Q60B + 0x01;
       Q45A = 0x01;
       break;
     case 0x0C
       Q57B = "";
       Q45A = 0x01;
       break;
     default
       Q57B = "no known minutes!";
       break;
     }
     if (Q60B > 0x17)
     {
       Q60B = 0x00;
     }
     switch (Q60B)
     {
     default
       Q4WP = "no known hour!";
       break;
     case 0x00
       Q4WP = "midnight";
       Q45A = 0x00;
       break;
     case 0x0C
       Q4WP = "noon";
       Q45A = 0x00;
       break;
     case 0x01
     case 0x0D
       Q4WP = "one";
       break;
     case 0x02
     case 0x0E
       Q4WP = "two";
       break;
     case 0x03
     case 0x0F
       Q4WP = "three";
       break;
     case 0x04
     case 0x10
       Q4WP = "four";
       break;
     case 0x05
     case 0x11
       Q4WP = "five";
       break;
     case 0x06
     case 0x12
       Q4WP = "six";
       break;
     case 0x07
     case 0x13
       Q4WP = "seven";
       break;
     case 0x08
     case 0x14
       Q4WP = "eight";
       break;
     case 0x09
     case 0x15
       Q4WP = "nine";
       break;
     case 0x0A
     case 0x16
       Q4WP = "ten";
       break;
     case 0x0B
     case 0x17
       Q4WP = "eleven";
       break;
     }
     if (Q45A)
     {
       Q4WP = Q4WP + " o'clock";
     }
     if ((Q60B > 0x00) && (Q60B < 0x0B))
     {
       Q4WP = Q4WP + " in the morning";
     }
     if ((Q60B > 0x0C) && (Q60B < 0x15))
     {
       Q4WP = Q4WP + " in the afternoon";
     }
     if (Q60B > 0x14)
     {
       Q4WP = Q4WP + " at night";
     }
     Q613 = "It is " + Q57B + " " + Q4WP + ".";
     bark(this, Q613);
     Q4J9(this);
     return (0x00);
   }
   return (0x01);
 }