break Cancels excecution of block of code. Block of code is always { }. Otherwise we can say, that it jumps to pair of last {. This:
while (0) {
echo($c++);
if ($c>10) break;
}
will print numbers from 0 to 11 and ten continue in code. function join($a,$b) {
return $a."-".$b;
}
echo(join("a","b");
will print "a-b" on screen. <value> is not requires. In this case returns "";
see
do <com> while (<cond>) While condition <cond> is true (1) exec command <com>.
do {
$a++;
} while ($a<5);
exists(<par>) Returns if prameter or returned class exists.
exit Cancels excecution of actual code. This:
{
echo ("a");
exit;
echo ("b");
}
will print only "a";
see
for (<com1>;<cond>;<com2>) code First exec command <com1>. Then until condition <cond> is true (=1) exec commands <com2> and <code>.
for ($ci=0;$ci<5;$ci++) echo($ci);
function <name> ([<kind>] <par1>[,...]) { <code> } Create block of commands, which can be called from other code by <name> and with local parameters <par1>..<parN>. This:
function test($a) {
echo($a);
}
test("ja");
will print "ja" on screen. <Kind> can defind type of parameter. If you enter text or number value then kind is var, otherwise is same as <any class>:class value ("item","beeing", etc.) . For example, we have function: function myDrop(item $a) {
if (!$a:exists()) return ; echo("Dropping ".$a:name);
$a:drop;
}
and when we will call it by myDrop(actor.inHand);
it will always work. Always mean that it will work also in case when actor:inHand dosn't exists. But when you try call myDrop("alex");
it returns error "Required item kind of parameter".
if (<cond>) <com1> [ else <com2> ] Evaluate condition <cond>. If it's true (1) exec command <com1>. If is not true and exist part else exec command <com2>
if ($a>5)
echo("lower");
else
echo("higher or equal");
local <$var>[=<value>][,...] If you need to declare local varible, for example inside function, use this variable. This:
$a=0;
function test() {
local $a=1;
echo($a);
}
test();
echo($a);
will print 1 and 0.
new <class>(<params>) Create new <class> with params <params>. Actually there are aviable these classes to create:
list() -
list.class
hash() -
hash.class
item(<item name>) -
item.class
Example:
$a=new list();
$a:put("carlo");
$a:put(1);
return [<value>] Returns <value> and exit from function. This command can be called only from function. This:
function join($a,$b) {
return $a."-".$b;
}
echo(join("a","b");
will print "a-b" on screen.
while (<cond>) com While condition <cond> is true (1) exec command <com>.
while ($a<5) {
$a++;
}
Generated by Hideoshi's Documentation Tool on 28.10.2003 20:08:54