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

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

Latest revision as of 22:33, 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.

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.