Release 5.8.5.1 beta available for test purpose.
Here are the commands that I never had the time nor the courage to do. I hope they are useful for you
send me feedback.
NB: $CurrPly = GetPlayerInfo( $userName );
$CurrPly is a special array who continusly updated with correct player values
but you can't assign it to another var array using $newVar = $CurrPly;
+-------------------------------+
|Changes from v5.850 to 5.851 |
+-------------------------------+
1. Add new struct control in GLSCRIPT
FOREACH( var IN arrayVar )
....
ENDFOREACH
Whith this struct you can parse an array without knowing index
put on each iteration one element of the array arrayVar in var
var is an array containing only index "key", "value"
"key" is the key in the array
"value" is the value
Example:
Script Code
$toto[0,1,0] = "Zero,Un";
$toto[1,1,0] = "Un,Un";
$toto[1,2,0] = "Un,Deux";
$toto[2,2,0] = "Deux,Deux";
$toto[3,1,0] = "Trois,Un";
$toto[4,0,0] = "Quatre,zero";
FOREACH( $myVar IN $tata )
writeLine( "Key = " . $myVar["key" ] . " Value = " . $myVar["value" ] );
ENDFOREACH
Result on screen
Key = toto,4,0,0 Value = Quatre,zero
Key = toto,0,1,0 Value = Zero,Un
Key = toto,1,1,0 Value = Un,Un
Key = toto,1,2,0 Value = Un,Deux
Key = toto,2,2,0 Value = Deux,Deux
Key = toto,3,1,0 Value = Trois,Un
2. Add new GLScrip Function dumpVar(), to dump the content of a var to screen, debug purpose
Example
In script
$toto[0,1,0] = "Zero,Un";
$toto[1,1,0] = "Un,Un";
$toto[1,2,0] = "Un,Deux";
$toto[2,2,0] = "Deux,Deux";
$toto[3,1,0] = "Trois,Un";
$toto[4,0,0] = "Quatre,zero";
dumpVar( $toto );
print on screen:
$toto[4,0,0] = "Quatre,zero"
$toto[0,1,0] = "Zero,Un"
$toto[1,1,0] = "Un,Un"
$toto[1,2,0] = "Un,Deux"
$toto[2,2,0] = "Deux,Deux"
$toto[3,1,0] = "Trois,Un"
3. Completely rewriting array management in GLScript, now you can assign an array to a new var or array,
partially or entirely.
Example
In Script
$toto[0,1,0] = "Zero,Un";
$toto[1,1,0] = "Un,Un";
$toto[1,2,0] = "Un,Deux";
$toto[2,2,0] = "Deux,Deux";
$toto[3,1,0] = "Trois,Un";
$toto[4,0,0] = "Quatre,zero";
$tata = $toto;
$part = $toto[1];
$var = $toto[4,0,0];
$inArray[1] = $toto[1];
Result in Vars:
$toto[0,1,0] = "Zero,Un";
$toto[1,1,0] = "Un,Un";
$toto[1,2,0] = "Un,Deux";
$toto[2,2,0] = "Deux,Deux";
$toto[3,1,0] = "Trois,Un";
$toto[4,0,0] = "Quatre,zero";
$tata[0,1,0] = "Zero,Un"
$tata[1,1,0] = "Un,Un"
$tata[1,2,0] = "Un,Deux"
$tata[2,2,0] = "Deux,Deux"
$tata[3,1,0] = "Trois,Un"
$tata[4,0,0] = "Quatre,zero"
$part[1,0] = "Un,Un"
$part[2,0] = "Un,Deux"
$var = "Quatre,zero"
$inArray[1,1,0] = "Un,Un"
$inArray[1,2,0] = "Un,Deux"
4. New GLScript command getPlayerInfo( userName ), this function return an array containing all player var.
!!!!!!!SORRY!!!!!!! but this is the future command who kill the next command list in the future
Command killed in the future :-)
GetCurrentPlayerVar
GetPlayerVar
SetCurrentPlayerVar
SetPlayerVar
Set a Var with getPlayerInfo and then use it like an Array Var to retreive player var or to set player var
funny isn't it?
Example:
Event OnConnect( $userName ) # Player event
$CurrPly = GetPlayerInfo( $userName ); # Set A var for the player infos
IF( $CurrPly["userName"] != "" ) THEN # Kip Host
WriteLine( $CurrPly["userName"] ); # Retreive a player Var
WriteLine( $CurrPly["nickName"] ); # Retreive a player Var
$CurrPly["ess"] = 12; # Set a player Var
WriteLine( $CurrPly["ess"] );
ENDIF
EndEvent
Next Stage it's send to all parameter event the userName
5. New GLScript command to have the size of an array
arrayCount( array );
Example:
$toto[ 1 ] = "Un";
$toto[ 2 ] = "Deux";
WriteLine( $toto );
Result on Screen
2