• Tutorials

  • Home
  • GPDL Variables



    DungeonCraft Help Home

    Variable names in GPDL can be of any length and are case-sensitive. System function names alway start with a dollar-sign. You should probably not start your variable names with a dollar-sign although it is not prohibited.

    As in 'C', variables are local to the function in which they are defined. They cannot be referenced from outside that function. For example:

    $FUNC checkForMushroom (characterClass)
      {
        $VAR x;
        x = "yes";
    
      } checkForMushroom ;
    
      $FUNC disolveBadges ( )
      {
        if (x == "yes")   // Compiler error...There ain't no x defined!
        {
              etc.
        };
      };

    Variables are allocated on the stack when a function is called. This means that recursive functions get a new copy of local variables each time it calls itself.