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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import of LLM wiki pages)
Line 1: Line 1:
−
= secure ( u : unitptr , label) =
 
  
−
Secures the unitptr 'u' and jumps to 'label' when the secure is broken.
 
  
−
  u : Unit to secure.
+
<span id="bpsec"></span>
−
  label : Label to jump to, on removal.
+
secure ( u : unitptr , label )
−
 
+
    u : Unit to secure.
−
Secures a unitptr, so that the program will go to 'label' if unit leaves local environment.
+
    label : Label to jump to, on removal.
−
The unit leaves the local environment when it is destroyed or e.g. moved to a different location
+
    result: Secures a unitptr, so that the program will go to 'label'
−
such as an adjacent room. A transparent room in a room would not count as leaving the local environment.
+
            if unit leaves local environment. If this happens, during
−
 
+
            a call to another function/procedure, it will continue
−
A DIL program is tested for secures in the follow circumstances:
+
            at that label when the function/procedure returns.
−
* When the DIL program is activated (e.g. after a pause / wait())
+
            If you perform some kind of call to a template, the removing
−
* When the DIL program has performed a send(), sendto(), sendtoall(), sendtoalldil().
+
            of a unit from the local environment will not have affect.
−
* When the DIL program calls updateposition() (because it might kill the unit)
+
            until the return from that function, as the program execution
−
* When the DIL program calls cast(), cast2() or attackspell(), meleeattack(), meleedamage().
+
            will continue at the designated label after a call. Should
−
* Returning from a DIL sub-function that has triggered a secure() scan.
+
            several secured units leave local environment, the last such
−
* In every foreach-next step
+
            event will determine the point of execution upon return.
−
 
 
−
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 10:44, 4 December 2025


secure ( u : unitptr , label )
   u : Unit to secure.
   label : Label to jump to, on removal.
   result: Secures a unitptr, so that the program will go to 'label'
           if unit leaves local environment. If this happens, during
           a call to another function/procedure, it will continue
           at that label when the function/procedure returns.
           If you perform some kind of call to a template, the removing
           of a unit from the local environment will not have affect.
           until the return from that function, as the program execution
           will continue at the designated label after a call. Should
           several secured units leave local environment, the last such
           event will determine the point of execution upon return.