Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-26-2006, 03:35 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Global clientside variables?

How would I make/use global clientside variables using gs1 (in an editor room) were any npc (including weapons) can change the variable? I am trieing to make a bumper that npc that when you touch it, it changes a different npc's variable (the movement direction).
I am pretty rusty with gs1 and 2 so please be patient with me...

By the way, I tried excluding the 'this.' when I used the variable but meh still no luck.
__________________
Reply With Quote
  #2  
Old 09-26-2006, 03:51 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
player.
Reply With Quote
  #3  
Old 09-26-2006, 09:30 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
will 'player.' this work for gs1 in the editor?
__________________
Reply With Quote
  #4  
Old 09-26-2006, 03:59 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Lol, ANYTHING works in the editor.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 09-26-2006, 04:16 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by xXziroXx View Post
Lol, ANYTHING works in the editor.
Not everything will work in the editor.

Variables without prefixes are Global. It doesn't work like that in the editor though, because variables without prefixes prior to the new engine functioned the same way was temp. variables do now.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 09-26-2006, 05:10 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by ApothiX View Post
Not everything will work in the editor.

Variables without prefixes are Global. It doesn't work like that in the editor though, because variables without prefixes prior to the new engine functioned the same way was temp. variables do now.
True, what I ment was that variables work differently in the editor then they do online. For example, a serverr. var/string can be set both clientside and serverside in the editor.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 09-26-2006, 06:10 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by xXziroXx View Post
True, what I ment was that variables work differently in the editor then they do online. For example, a serverr. var/string can be set both clientside and serverside in the editor.
O_o but you said just the opposite of that, you said "ANYTHING works in the editor"
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #8  
Old 09-26-2006, 06:44 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by ApothiX View Post
O_o but you said just the opposite of that, you said "ANYTHING works in the editor"
Yeah but, ugh, I ment like.. bah, I ment that it doesnt mather if you have try to set a serverr. clientside, it WORKS in the editor. You can name a var global.pievar.of.leetness and it will most likely work in the editor.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 09-26-2006, 06:40 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by ApothiX View Post
Not everything will work in the editor.

Variables without prefixes are Global. It doesn't work like that in the editor though, because variables without prefixes prior to the new engine functioned the same way was temp. variables do now.
Compare:
Old GraalScript
PHP Code:
if (created) {
  
i=50;
  
test();
  
message #v(i);
}
function 
test() {
  
i=30;
  return;

The above code displays "30"

New GraalScript
PHP Code:
function onCreated() {
  
temp.i=50;
  
test();
  
message(temp.i);
}
function 
test() {
  
temp.i=30;
  return;

The above code displays "50"

And another thing, in the editor, I placed two scripts:
PHP Code:
if (createdi=234
PHP Code:
if (createdmessage #v(i); 
And the second displayed "234"

Let's not confuse people with false information now. Variables without prefixes are global, and have been global (with some exceptions).
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #10  
Old 09-29-2006, 02:20 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Tolnaftate2004 View Post
Compare:
Old GraalScript
PHP Code:
if (created) {
  
i=50;
  
test();
  
message #v(i);
}
function 
test() {
  
i=30;
  return;

The above code displays "30"

New GraalScript
PHP Code:
function onCreated() {
  
temp.i=50;
  
test();
  
message(temp.i);
}
function 
test() {
  
temp.i=30;
  return;

The above code displays "50"

And another thing, in the editor, I placed two scripts:
PHP Code:
if (createdi=234
PHP Code:
if (createdmessage #v(i); 
And the second displayed "234"

Let's not confuse people with false information now. Variables without prefixes are global, and have been global (with some exceptions).
They are global, but they they are only global to that one NPC. In the new engine, any NPC running in the same scope can access an unprefixed variable. They are removed after script execution is complete, just like the temp.prefix variables.

Try not to correct me unless you know what you're talking about, and what context the question was phrased in.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #11  
Old 09-29-2006, 06:01 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by ApothiX
They are removed after script execution is complete, just like the temp.prefix variables.
See Ex. 1.
Quote:
Originally Posted by ApothiX
They are global, but they they are only global to that one NPC. In the new engine, any NPC running in the same scope can access an unprefixed variable.
See Ex. 2.

You are wrong.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 09-29-2006 at 06:19 PM..
Reply With Quote
Reply


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 04:19 PM.


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