Difference between revisions of "Script: Guilded"

From Ultima Online: The Second Age
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
  forward <span style="color:#0000FF">string</span> [[Script_Function:_guildName|<span style="color:#2B91AF">guildName</span>]]();
 
  forward <span style="color:#0000FF">string</span> [[Script_Function:_guildName|<span style="color:#2B91AF">guildName</span>]]();
 
  forward <span style="color:#0000FF">string</span> [[Script_Function:_Q4UL|<span style="color:#2B91AF">Q4UL</span>]]();
 
  forward <span style="color:#0000FF">string</span> [[Script_Function:_Q4UL|<span style="color:#2B91AF">Q4UL</span>]]();
  forward <span style="color:#0000FF">string</span> [[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]();
+
  forward <span style="color:#0000FF">string</span> [[Script_Function:_myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]();
 
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Q4TI|<span style="color:#2B91AF">Q4TI</span>]](<span style="color:#0000FF">obj</span> this);
 
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Q4TI|<span style="color:#2B91AF">Q4TI</span>]](<span style="color:#0000FF">obj</span> this);
 
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]](<span style="color:#0000FF">obj</span> this);
 
  forward <span style="color:#0000FF">void</span> [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]](<span style="color:#0000FF">obj</span> this);
Line 12: Line 12:
 
   <span style="color:#0000FF">if</span> (ab == <span style="color:#800000">"none"</span>)
 
   <span style="color:#0000FF">if</span> (ab == <span style="color:#800000">"none"</span>)
 
   {
 
   {
     ab = [[guildName|<span style="color:#2B91AF">guildName</span>]]();
+
     ab = [[Script_Function:_guildName|<span style="color:#2B91AF">guildName</span>]]();
 
   }
 
   }
 
   <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"displayGuildAbbr"</span>))
 
   <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"displayGuildAbbr"</span>))
Line 49: Line 49:
 
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">string</span> myGuildTitle()
 
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">string</span> myGuildTitle()
 
  {
 
  {
   <span style="color:#0000FF">if</span> (![[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](me, <span style="color:#800000">"[[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]"</span>))
+
   <span style="color:#0000FF">if</span> (![[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](me, <span style="color:#800000">"myGuildTitle"</span>))
 
   {
 
   {
 
     [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]](me);
 
     [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]](me);
 
   }
 
   }
   <span style="color:#0000FF">string</span> x = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](me, <span style="color:#800000">"[[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]"</span>);
+
   <span style="color:#0000FF">string</span> x = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](me, <span style="color:#800000">"myGuildTitle"</span>);
 
   <span style="color:#0000FF">return</span> (x);
 
   <span style="color:#0000FF">return</span> (x);
 
  }
 
  }
Line 62: Line 62:
 
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildName"</span>, <span style="color:#800000">"unaffiliated"</span>);
 
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildName"</span>, <span style="color:#800000">"unaffiliated"</span>);
 
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildAbbreviation"</span>, <span style="color:#800000">"none"</span>);
 
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildAbbreviation"</span>, <span style="color:#800000">"none"</span>);
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"[[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]"</span>, <span style="color:#800000">""</span>);
+
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"myGuildTitle"</span>, <span style="color:#800000">""</span>);
 
   [[Script_Function:_Q4TI|<span style="color:#2B91AF">Q4TI</span>]](this);
 
   [[Script_Function:_Q4TI|<span style="color:#2B91AF">Q4TI</span>]](this);
 
   <span style="color:#0000FF">return</span> (0x01);
 
   <span style="color:#0000FF">return</span> (0x01);
Line 86: Line 86:
 
   <span style="color:#0000FF">string</span> Q43L = args[0x02];
 
   <span style="color:#0000FF">string</span> Q43L = args[0x02];
 
   <span style="color:#0000FF">string</span> Q43O = args[0x03];
 
   <span style="color:#0000FF">string</span> Q43O = args[0x03];
   <span style="color:#0000FF">if</span> (Q43M != [[guildName|<span style="color:#2B91AF">guildName</span>]]())
+
   <span style="color:#0000FF">if</span> (Q43M != [[Script_Function:_guildName|<span style="color:#2B91AF">guildName</span>]]())
 
   {
 
   {
     [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](this, <span style="color:#800000">"The name of your guild has changed from "</span> + [[guildName|<span style="color:#2B91AF">guildName</span>]]() + <span style="color:#800000">" to "</span> + Q43M + <span style="color:#800000">"."</span>);
+
     [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](this, <span style="color:#800000">"The name of your guild has changed from "</span> + [[Script_Function:_guildName|<span style="color:#2B91AF">guildName</span>]]() + <span style="color:#800000">" to "</span> + Q43M + <span style="color:#800000">"."</span>);
 
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildName"</span>, Q43M);
 
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildName"</span>, Q43M);
 
   }
 
   }
Line 96: Line 96:
 
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildAbbreviation"</span>, Q43L);
 
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"guildAbbreviation"</span>, Q43L);
 
   }
 
   }
   <span style="color:#0000FF">if</span> (Q43O != [[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]())
+
   <span style="color:#0000FF">if</span> (Q43O != [[Script_Function:_myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]())
 
   {
 
   {
 
     [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](this, <span style="color:#800000">"You have been given a new guild title: "</span> + Q43O + <span style="color:#800000">"."</span>);
 
     [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](this, <span style="color:#800000">"You have been given a new guild title: "</span> + Q43O + <span style="color:#800000">"."</span>);
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"[[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]"</span>, Q43O);
+
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"myGuildTitle"</span>, Q43O);
 
   }
 
   }
 
   <span style="color:#0000FF">if</span> (!Q4ZH)
 
   <span style="color:#0000FF">if</span> (!Q4ZH)
 
   {
 
   {
     [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](this, <span style="color:#800000">"You have been dismissed from "</span> + [[guildName|<span style="color:#2B91AF">guildName</span>]]() + <span style="color:#800000">"."</span>);
+
     [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](this, <span style="color:#800000">"You have been dismissed from "</span> + [[Script_Function:_guildName|<span style="color:#2B91AF">guildName</span>]]() + <span style="color:#800000">"."</span>);
 
     [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]](this);
 
     [[Script_Function:_Cleanup|<span style="color:#2B91AF">cleanup</span>]](this);
 
   }
 
   }
Line 113: Line 113:
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"guildName"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"guildName"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"guildAbbreviation"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"guildAbbreviation"</span>);
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"[[myGuildTitle|<span style="color:#2B91AF">myGuildTitle</span>]]"</span>);
+
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"myGuildTitle"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"guildstoneId"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"guildstoneId"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"displayGuildAbbr"</span>);
 
   [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"displayGuildAbbr"</span>);

Latest revision as of 06:10, 24 October 2018

forward string guildName();
forward string Q4UL();
forward string myGuildTitle();
forward void Q4TI(obj this);
forward void cleanup(obj this);
member obj me;
trigger lookedat
{
  string ab = getObjVar(this, "guildAbbreviation");
  if (ab == "none")
  {
    ab = guildName();
  }
  if (hasObjVar(this, "displayGuildAbbr"))
  {
    barkTo(this, looker, "[" + ab + "]");
  }
  return (0x01);
}
trigger objectloaded
{
  Q4TI(this);
  return (0x01);
}
function string guildName()
{
  if (!hasObjVar(me, "guildName"))
  {
    cleanup(me);
  }
  string x = getObjVar(me, "guildName");
  return (x);
}
function string Q4UL()
{
  if (!hasObjVar(me, "guildAbbreviation"))
  {
    cleanup(me);
  }
  string x = getObjVar(me, "guildAbbreviation");
  return (x);
}
function string myGuildTitle()
{
  if (!hasObjVar(me, "myGuildTitle"))
  {
    cleanup(me);
  }
  string x = getObjVar(me, "myGuildTitle");
  return (x);
}
trigger creation
{
  me = this;
  setObjVar(this, "guildName", "unaffiliated");
  setObjVar(this, "guildAbbreviation", "none");
  setObjVar(this, "myGuildTitle", "");
  Q4TI(this);
  return (0x01);
}
function void Q4TI(obj this)
{
  if (!hasObjVar(this, "guildstoneId"))
  {
    cleanup(me);
    return ();
  }
  obj Q4UE = getObjVar(this, "guildstoneId");
  list blah;
  multimessage(Q4UE, "updateMyGuildInfo", blah);
  return ();
}
trigger message("updateGuildInfo")
{
  int Q4ZH = args[0x00];
  string Q43M = args[0x01];
  string Q43L = args[0x02];
  string Q43O = args[0x03];
  if (Q43M != guildName())
  {
    systemMessage(this, "The name of your guild has changed from " + guildName() + " to " + Q43M + ".");
    setObjVar(this, "guildName", Q43M);
  }
  if (Q43L != Q4UL())
  {
    systemMessage(this, "Your guild abbreviation has changed from " + Q4UL() + " to " + Q43L + ".");
    setObjVar(this, "guildAbbreviation", Q43L);
  }
  if (Q43O != myGuildTitle())
  {
    systemMessage(this, "You have been given a new guild title: " + Q43O + ".");
    setObjVar(this, "myGuildTitle", Q43O);
  }
  if (!Q4ZH)
  {
    systemMessage(this, "You have been dismissed from " + guildName() + ".");
    cleanup(this);
  }
  return (0x01);
}
function void cleanup(obj this)
{
  removeObjVar(this, "guildName");
  removeObjVar(this, "guildAbbreviation");
  removeObjVar(this, "myGuildTitle");
  removeObjVar(this, "guildstoneId");
  removeObjVar(this, "displayGuildAbbr");
  detachScript(this, "guilded");
  return ();
}
trigger message("removedFromGuild")
{
  cleanup(this);
  return (0x01);
}
trigger message("guildMessage")
{
  string Q65L = args[0x00];
  systemMessage(this, "Guild message: " + Q65L);
  return (0x01);
}
trigger message("globalGuildMessage")
{
  string Q65L = args[0x00];
  systemMessage(this, "Guild message: " + Q65L);
  return (0x01);
}