Difference between revisions of "Manual:DIL Manual/secure()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
Line 1: Line 1:
 +
= secure ( u : unitptr , label) =
  
 +
Secures the unitptr 'u' and jumps to 'label' when the secure is broken.
  
<span id="bpsec"></span>
+
  u : Unit to secure.
secure ( u : unitptr , label )
+
  label : Label to jump to, on removal.
    u : Unit to secure.
+
 
    label : Label to jump to, on removal.
+
Secures a unitptr, so that the program will go to 'label' if unit leaves local environment.
    result: Secures a unitptr, so that the program will go to 'label'
+
The unit leaves the local environment when it is destroyed or e.g. moved to a different location
            if unit leaves local environment. If this happens, during
+
such as an adjacent room. A transparent room in a room would not coust as leaving the local environment.
            a call to another function/procedure, it will continue
+
 
            at that label when the function/procedure returns.
+
A DIL program is tested for secures in the follow circumstances:
            If you perform some kind of call to a template, the removing
+
* When the DIL program is activated (e.g. after a pause / wait())
            of a unit from the local environment will not have affect.
+
* When the DIL program has performed a send(), sendto(), sendtoall(), sendtoalldil().
            until the return from that function, as the program execution
+
* When the DIL program calls updateposition() (because it might kill the unit)
            will continue at the designated label after a call. Should
+
* When the DIL program calls cast(), cast2() or attackspell(), meleeattack(), meleedamage().
            several secured units leave local environment, the last such
+
* Returning from a DIL sub-function that has triggered a secure() scan.
            event will determine the point of execution upon return.
+
* In every foreach-next step [needs to be evaluated further]
 +
 
 +
A DIL program will test a specific unit for secure in the follow circumstances:
 +
* DIL destroy(u) will test if 'u' was a secured() variable and if so will trigger it if destroyed.
 +
* DIL exec(str, u) will test if 'u' was a secured() variable and if so will trigger it if destroyed.
 +
A specific test will also cascade down through frames.
 +
 
 +
If a secure() is triggered during execution in a sub-function/procedure, then once execution returns to
 +
the parent frame, then the parent frame will test for secure() violations before continuing execution.  
 +
 
 +
Should several secured units leave local environment, the last such event will determine the point of execution upon return.
 +
 
 +
See also:
 +
  > unsecure

Revision as of 18:22, 13 August 2022

secure ( u : unitptr , label)

Secures the unitptr 'u' and jumps to 'label' when the secure is broken.

 u : Unit to secure.
 label : Label to jump to, on removal.

Secures a unitptr, so that the program will go to 'label' if unit leaves local environment. The unit leaves the local environment when it is destroyed or e.g. moved to a different location such as an adjacent room. A transparent room in a room would not coust as leaving the local environment.

A DIL program is tested for secures in the follow circumstances:

  • When the DIL program is activated (e.g. after a pause / wait())
  • When the DIL program has performed a send(), sendto(), sendtoall(), sendtoalldil().
  • When the DIL program calls updateposition() (because it might kill the unit)
  • When the DIL program calls cast(), cast2() or attackspell(), meleeattack(), meleedamage().
  • Returning from a DIL sub-function that has triggered a secure() scan.
  • In every foreach-next step [needs to be evaluated further]

A DIL program will test a specific unit for secure in the follow circumstances:

  • DIL destroy(u) will test if 'u' was a secured() variable and if so will trigger it if destroyed.
  • DIL exec(str, u) will test if 'u' was a secured() variable and if so will trigger it if destroyed.

A specific test will also cascade down through frames.

If a secure() is triggered during execution in a sub-function/procedure, then once execution returns to the parent frame, then the parent frame will test for secure() violations before continuing execution.

Should several secured units leave local environment, the last such event will determine the point of execution upon return.

See also:

 > unsecure