Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14  
Old 05-05-2011, 12:12 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by papajchris View Post
Can strings like clientr. and client only be numbers? When I do scripts such as the following, they don't appear in attributes.

PHP Code:
function onPlayerTouchsme() {
 
client.high3=false;

client and clientr variables can be anything but objects.

PHP Code:
player.clientr.foo "bar"// string
player.clientr.bar 10 3// number
player.clientr.baz = {"one""two"}; // array
player.clientr.baa true// boolean 
Unlike languages like Java, Graal is a dynamically-typed language, which means you don't have to tell Graal what type of variable you want something to be. In Java, you would have to do

PHP Code:
String foo "bar";
int bar 10 3;
String[] baz = {"one""two"};
boolean baa true
Since you don't have to do that in Graal, the engine internally converts certain values to others. This doesn't affect behavior in this case.

Setting a value to true will show it equal to 1. Setting it to false will either show it equal to 0 or remove it from attributes altogether. Either works.

If a variable has never been set to false, it will by default be false.
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.