Difference between revisions of "Procedure Flags"

From WikiName
Jump to: navigation, search
(Created page with " __TOC__ = Overview = Procedure flags are flags that can be used to modify code behavior during and after special procedures are run. The flags are stored in an integer as...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
= Overview =
 
= Overview =
  
Procedure flags are flags that can be used to modify code behavior during and after special procedures are run.  The flags are stored in an integer as a bitvector and can be accessed in C code via the pParam->iProcedureFlags variable.  In [[Proc:MUDL2|MUDL2]] the flags can be accessed using the %f global variable.
+
Procedure flags are flags that can be used to modify code behavior during and after special procedures are run.  The flags are stored in an integer as a bitvector and can be accessed in C code via the pParam->iProcedureFlags variable.  In [[MUDL2]] the flags can be accessed using the %f or %procedure_flags global variable.
  
  
Line 13: Line 13:
 
|-
 
|-
 
| PROC_OVERRODE_COMMAND
 
| PROC_OVERRODE_COMMAND
|
+
| overrode-command
 
| The special procedure has handled the command entered by the player.  This tells the MUD that it should abort processing the command after the procedures are complete since the command has already been handled.
 
| The special procedure has handled the command entered by the player.  This tells the MUD that it should abort processing the command after the procedures are complete since the command has already been handled.
 
|-
 
|-
 
| PROC_ABORT_PROCS
 
| PROC_ABORT_PROCS
|
+
| abort-procedures
 
| The special procedure uses this flag to tell the MUD to stop running procedures after the current one.
 
| The special procedure uses this flag to tell the MUD to stop running procedures after the current one.
 
|-
 
|-
 
| PROC_SUPPRESS_LOOK
 
| PROC_SUPPRESS_LOOK
|
+
| suppress-look
 
| The special procedure uses this flag to tell the MUD not to perform a "look" command once the player is added to a new room.
 
| The special procedure uses this flag to tell the MUD not to perform a "look" command once the player is added to a new room.
 
|-
 
|-
 
| PROC_SUCCESS
 
| PROC_SUCCESS
|
+
| success
 
| This flag must be used with PROC_OVERRODE_COMMAND.  This tells the MUD that it should act as if the command was successfully executed and make any modifications to player statistics as such.  Currently used to indicate a spell was successfully cast so that the MUD will subtract the full mana cost of casting the spell.
 
| This flag must be used with PROC_OVERRODE_COMMAND.  This tells the MUD that it should act as if the command was successfully executed and make any modifications to player statistics as such.  Currently used to indicate a spell was successfully cast so that the MUD will subtract the full mana cost of casting the spell.
 
|-
 
|-
 
| PROC_SENT_MESSAGES
 
| PROC_SENT_MESSAGES
|
+
| sent-messages
 
| This flag is used to indicate whether messages to the players regarding this command have been sent.  In the case of casting a spell, it would be the messages "Player utters the words, ...".
 
| This flag is used to indicate whether messages to the players regarding this command have been sent.  In the case of casting a spell, it would be the messages "Player utters the words, ...".
 
|}
 
|}
  
 +
 +
= MUDL2 Example =
 +
<pre>
 +
addproc <mobile> mudl
 +
setproc <mobile> 0 intercept_ask_bss
 +
 +
if ('quest' = %s[1],
 +
(
 +
    send_msgs_for_ask(%a, %c, %1, %2, %3),
 +
 +
    cmd(%c, 'say Yes I have a quest for you!'),
 +
    set(flag(%f, 'procedure-flags', 'overrode-command'), true),
 +
    return(true)
 +
)),
 +
return(false)
 +
@
  
 
[[Category:Building]]
 
[[Category:Building]]

Latest revision as of 20:38, 16 May 2017

Overview

Procedure flags are flags that can be used to modify code behavior during and after special procedures are run. The flags are stored in an integer as a bitvector and can be accessed in C code via the pParam->iProcedureFlags variable. In MUDL2 the flags can be accessed using the %f or %procedure_flags global variable.


Flag Values

C Define MUDL Name Description
PROC_OVERRODE_COMMAND overrode-command The special procedure has handled the command entered by the player. This tells the MUD that it should abort processing the command after the procedures are complete since the command has already been handled.
PROC_ABORT_PROCS abort-procedures The special procedure uses this flag to tell the MUD to stop running procedures after the current one.
PROC_SUPPRESS_LOOK suppress-look The special procedure uses this flag to tell the MUD not to perform a "look" command once the player is added to a new room.
PROC_SUCCESS success This flag must be used with PROC_OVERRODE_COMMAND. This tells the MUD that it should act as if the command was successfully executed and make any modifications to player statistics as such. Currently used to indicate a spell was successfully cast so that the MUD will subtract the full mana cost of casting the spell.
PROC_SENT_MESSAGES sent-messages This flag is used to indicate whether messages to the players regarding this command have been sent. In the case of casting a spell, it would be the messages "Player utters the words, ...".


MUDL2 Example

addproc <mobile> mudl
setproc <mobile> 0 intercept_ask_bss

if ('quest' = %s[1],
(
    send_msgs_for_ask(%a, %c, %1, %2, %3),

    cmd(%c, 'say Yes I have a quest for you!'),
    set(flag(%f, 'procedure-flags', 'overrode-command'), true),
    return(true)
)),
return(false)
@