Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
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
  #2  
Old 05-05-2011, 01:12 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Correct me if I'm wrong but float( false) would make it show 0 in the flags list.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:50 PM.


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