Difference between revisions of "Manual:DIL Manual/Expressions"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
m
 
Line 3: Line 3:
 
<span id="express"></span>
 
<span id="express"></span>
  
  <h3>'''Expressions:'''</h3>
+
  <h3>Expressions:</h3>
 
   The expressions used in assignment can return any
 
   The expressions used in assignment can return any
 
   of the types you can declare variables. Also they might return
 
   of the types you can declare variables. Also they might return

Latest revision as of 14:14, 29 June 2020


Expressions:

  The expressions used in assignment can return any
  of the types you can declare variables. Also they might return
  fail or null. An expression returning fail will not result
  in any action being taken. Fail is returned when you
  request a field from a null pointer, or the like.
Example:

   dilbegin foo();
   var
     myvarsl : stringlist;
     myvars : string;
     myvarint : integer;
     myvaredp : extraptr;
     myvarunit : unitptr;
   code
   {
     :start:
     myvarunit := self.inside.next;
     myvarsl := {"a string","another","the last"};
     myvars := self.name+" XX "+itoa(self.hp);
     myvarint := activator.hp;
     myvaredp := "Rabbit Stew Complete" in activator.quests;
     pause;
     goto start:
   }
   dilend
---~---~---~---~---~---~---~---~---