Difference between revisions of "Manual:DIL Manual/send done()"

From DikuMUD Wiki
Jump to navigation Jump to search
(Adding new parameter to handle CMD_AUTO_)
 
Line 1: Line 1:
 
= senddone() =
 
= senddone() =
 
'''Function:'''
 
'''Function:'''
  send_done( c : string, a :unitptr, m : unitptr, t :unitptr, p : integer, arg : string, o : unitptr);
+
  send_done( c : string, a :unitptr, m : unitptr, t :unitptr, p : integer, arg : string, o : unitptr, i : integer);
  
 
  <!--TERM-->  '''c'''
 
  <!--TERM-->  '''c'''
Line 17: Line 17:
 
  <!--TERM-->  '''o'''
 
  <!--TERM-->  '''o'''
 
  <!--DEFINITION-->        the unitptr (other) you also want the message to go to
 
  <!--DEFINITION-->        the unitptr (other) you also want the message to go to
 +
<!--TERM-->  '''i'''
 +
<!--DEFINITION-->        CMD_AUTO_XXX to send a CMD_AUTO or 0
  
  
Line 132: Line 134:
  
 
  :read_quit:
 
  :read_quit:
   send_done("read",self,null,u,0,arg,null);
+
   send_done("read",self,null,u,0,arg,null,0);
 
  quit;
 
  quit;
 
  }
 
  }
 
  dilend
 
  dilend

Latest revision as of 15:45, 2 July 2022

senddone()

Function:

send_done( c : string, a :unitptr, m : unitptr, t :unitptr, p : integer, arg : string, o : unitptr, i : integer);
  c
         the command string that is sending the message
  a
         the unitptr (activator) that activated the message
  m
         the unitptr (medium) that the Dil is acting through
  t
         the unitptr (target) the Dil is acting on
  p
         the power of the message
  arg
         the argument sent with the message
  o
         the unitptr (other) you also want the message to go to
  i
         CMD_AUTO_XXX to send a CMD_AUTO or 0


This sends the 'SFB_DONE' message to any dils that are waiting for it in the surrounding area and to the other pointer if not null. The following is just one example you can find many more in commands.zon

Built-in variables:

 activator : unitptr
 medium    : unitptr
 target    : unitptr
 argument  : string
 power     : integer
Example:
dilbegin do_read (arg:string);
var
brdname:string;
        i:integer;
        u:unitptr;
        x:extraptr;
        ln:integer;
        temp:string;
        templist:stringlist;
        buff:string;
        f_name:string;
        act_str:string;
code
{
  i:=atoi (arg);
 if (i<0)
        {
        exec ("look "+arg,self);
        goto read_quit;
        }

if (itoa (i)!=arg)
        {
        exec ("look "+arg,self);
        goto read_quit;
        }

u:=self.outside.inside;
while (u!=null)
        {
        if ((u.type==UNIT_ST_OBJ) and (u.objecttype==ITEM_BOARD))
                break;
        u:=u.next;
        }

if (u==null)
        {
        act ("You do not see that here.",A_ALWAYS,self,null,null,TO_CHAR);
        quit;
        }

                if (u.extra.["$BOARD_L_RES"].descr!="")
                {
                act_str:=u.extra.["$BOARD_L_RES"].descr(self,u);
                if (act_str!="")
                {
        act(act_str,
                        A_ALWAYS,self,null,null,TO_CHAR);
                quit;
                }
                }
brdname:=u.names.[length (u.names)-1];
i:=loadstr (brdname+".idx",temp);
if (i<=0)
        {
        act ("But the board is empty!",
                A_ALWAYS,self,null,null,TO_CHAR);
        goto read_quit;
        }
templist:=split(temp,"&x");
ln:=length (templist);
x:="$BOARD_MAX" in self.extra;
if ((atoi(arg)>atoi(x.descr)) or
(atoi(arg)>ln))
        {
        act("That message exists only within the boundaries of your mind.",
                A_ALWAYS,self,null,null,TO_CHAR);
        goto read_quit;
        }
i:=atoi(arg);
temp:=templist.[i-1];
f_name:=getword(temp);
i:=loadstr (brdname+"."+f_name,buff);
if (i==0)
        {
        sendtext("You have to let the poster finish the post before reading it.",self);
        quit;
        }
if (i<1)
        {
        log("05: Error when loading board info.");
        act ("This board is not working report to an Administrator",
                A_ALWAYS,self,null,null,TO_CHAR);
                quit;
                }
templist:=split(f_name,".");
if (length(templist)<2)
        act ("Message "+arg+":  "+temp,
                A_ALWAYS,self,null,null,TO_CHAR);
else
        act ("Message "+arg+":  Re:  "+temp,
                A_ALWAYS,self,null,null,TO_CHAR);
pagestring(buff,self);
:read_quit:
 send_done("read",self,null,u,0,arg,null,0);
quit;
}
dilend