User Tools

Site Tools


scripting:basic_syntax

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scripting:basic_syntax [2020/01/28 18:58] – [Loops] 51.148.136.100scripting:basic_syntax [2023/05/15 02:08] (current) – [Arrays] mit
Line 46: Line 46:
  
 Code comments are simple C-stylee, e.g  Code comments are simple C-stylee, e.g 
-<codedoc>+<code>
     // Check the item number     // Check the item number
     if ( $itemNum = 112 )      if ( $itemNum = 112 )
Line 52: Line 52:
 //      *say Nothing (this line is commented out) //      *say Nothing (this line is commented out)
     }     }
-</codedoc>+</code>
  
 ===== Maths operators ===== ===== Maths operators =====
  
-Basic maths operators are supported in simple form. Compound operations are not yet supported so each line needs to be kept basic, e.g. :+Basic maths operators are supported in simple form. Compound operations are not yet supported so each line needs to be kept to a single operation, e.g. :
  
-<codedoc>+<code>
      $var = 1      $var = 1
      $newvar = $var * 100      $newvar = $var * 100
      $var += 1      $var += 1
-</codedoc>+</code>
  
 Currently the 4 basic operators ( ''+, -, /, *'' ) are supported, along with ( ''+=, -=, /=, *='' ) for operating on the LHS variable (e.g. ''$var += 1'' is equivalent to ''$var = $var + 1''. Currently the 4 basic operators ( ''+, -, /, *'' ) are supported, along with ( ''+=, -=, /=, *='' ) for operating on the LHS variable (e.g. ''$var += 1'' is equivalent to ''$var = $var + 1''.
Line 73: Line 73:
  
 Example Local variable use : Example Local variable use :
-<codedoc>+<code>
 Event( "UseItem", "Bongos" ) Event( "UseItem", "Bongos" )
 { {
Line 82: Line 82:
    }    }
 } }
-</codedoc>+</code>
 Example module variable use : Example module variable use :
-<codedoc>+<code>
 $mNumberOfBongoPlays = 0 $mNumberOfBongoPlays = 0
 Event( "UseItem", "Bongos" ) Event( "UseItem", "Bongos" )
Line 91: Line 91:
    *say $mNumberOfBongoPlays people have played the bongos since the script was last restarted    *say $mNumberOfBongoPlays people have played the bongos since the script was last restarted
 } }
-</codedoc>+</code>
 Example global variable use : Example global variable use :
-<codedoc>+<code>
 global $kNumberOfBongoPlays = 0 global $kNumberOfBongoPlays = 0
 Event( "UseItem", "Bongos" ) Event( "UseItem", "Bongos" )
Line 100: Line 100:
    *say $kNumberOfBongoPlays people have played the bongos since the script was last restarted    *say $kNumberOfBongoPlays people have played the bongos since the script was last restarted
 } }
-</codedoc>+</code>
  
 ===== Arrays ===== ===== Arrays =====
Line 108: Line 108:
 Arrays are declared and referenced as shown : Arrays are declared and referenced as shown :
  
-<codedoc>+<code>
 $maTestArray[] =  $maTestArray[] = 
 { {
Line 120: Line 120:
    *say The second text item in the array is $maTestArray[4]     *say The second text item in the array is $maTestArray[4] 
 } }
-</codedoc>+</code>
  
 .. which would print 'The first value in the array is 100' followed by 'The second text item in the array is Item 2'. .. which would print 'The first value in the array is 100' followed by 'The second text item in the array is Item 2'.
  
  
->> * [[Scripting:Other Language Features|Other Important Language Features]]+* [[Scripting:Other Language Features|Other Important Language Features]]
  
  
  
  
scripting/basic_syntax.1580259483.txt.gz · Last modified: 2020/01/28 18:58 by 51.148.136.100

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki