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 03-21-2008, 02:06 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
'var', what's up with 'var'?

lets see..

PHP Code:
for(temp.var : {"rawr,rawr,rawr"}) {
  echo(var);
}
/*
error: unexpected token: var at line 2: echo(var);
error: unexpected token: ) at line 2: echo(var);
*/ 
Now, what's wrong with that? It was working perfectly before

Using var can't be used anywhere any longer?
And is now being used as:
PHP Code:
var foo 2;
echo(
foo); 
similar to javascript? hmm?

What's with the sudden use of var? I now have to rescript all scripts on Symphonia just because the use the word VAR...

PHP Code:
function test(var) {
  echo(var);
}
/*
error: unexpected symbol var at line 1: function test(var) {
*/ 

So, yet again I have to ask, whats with the sudden use of var?
__________________

Last edited by Chompy; 03-21-2008 at 04:48 PM..
Reply With Quote
  #2  
Old 03-21-2008, 02:46 AM
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
I haven't noticed this o.o
__________________
Reply With Quote
  #3  
Old 03-21-2008, 03:04 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
I haven't noticed this o.o
Hmm, weird, happens with all scripts that contain 'var' on symphonia.. gotta try some other places I have rc on
__________________
Reply With Quote
  #4  
Old 03-21-2008, 03:09 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Chompy View Post
PHP Code:
for(temp.var : "rawr,rawr,rawr") {
  echo(var);
}
/*
error: unexpected token: var at line 2: echo(var);
error: unexpected token: ) at line 2: echo(var);
*/ 
PHP Code:
for(temp.var : {"rawr,rawr,rawr"}) {
  echo(var);

Works fine on N-Pulse.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 03-21-2008, 03:22 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Tigairius View Post
PHP Code:
for(temp.var : {"rawr,rawr,rawr"}) {
  echo(var);

Works fine on N-Pulse.
Works fine on AEON too.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #6  
Old 03-21-2008, 03:24 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Tigairius View Post
PHP Code:
for(temp.var : {"rawr,rawr,rawr"}) {
  echo(var);

Works fine on N-Pulse.
Bah, doesn't work on symp
__________________
Reply With Quote
  #7  
Old 03-21-2008, 03:27 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Chompy View Post
Bah, doesn't work on symp
Are you including the {}?
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #8  
Old 03-21-2008, 03:32 AM
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 Tigairius View Post
Are you including the {}?
It happens in all instances of var, not just the code posted above.
__________________
◕‿‿◕ · 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
  #9  
Old 03-21-2008, 03:44 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
If you're saying it works fine then restart your NPC-Server and try again. It takes a restart for the NPC-Server to update to the latest version.
__________________
Reply With Quote
  #10  
Old 03-21-2008, 04:44 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Works on Era, too.
Reply With Quote
  #11  
Old 03-21-2008, 04:47 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Still doesn't work on Symp, too.
__________________
Reply With Quote
  #12  
Old 03-21-2008, 06:20 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Maybe it's only supported on older npc servers?
__________________
Do it with a DON!
Reply With Quote
  #13  
Old 03-21-2008, 08:59 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I restarted the npcserver and the var thing isn't working now, so it must be something up with the new update.

Is there a changelog somewhere? The update messed up the mud on AEON, and I have a feeling it's because of a variable that is now read only for some reason.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.

Last edited by napo_p2p; 03-21-2008 at 09:27 PM..
Reply With Quote
  #14  
Old 03-21-2008, 10:05 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Uh-oh. Doesnt sound good. Somebody clear this up *looks around for Stefan*
Reply With Quote
  #15  
Old 03-21-2008, 10:17 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
You can't just take variables that are being used and disable them x.x

What the hell is wrong with Stefan?
__________________
Reply With Quote
  #16  
Old 03-21-2008, 10:21 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
We have uploaded new versions of gserver and npcserver to the playerworld machines for fixing the problem with a playerworld that was lagging a lot. There are a few modifications to the scripting: it is much faster now and we've improved the compatibility to javascript/actionscript. There are several new keywords which are basicly ignored ("static" and "var"). It was not meant to be used for other servers though, it could be possible to add a check for still allowing them as normal variables.
Reply With Quote
  #17  
Old 03-21-2008, 10:38 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
We have uploaded new versions of gserver and npcserver to the playerworld machines for fixing the problem with a playerworld that was lagging a lot. There are a few modifications to the scripting: it is much faster now and we've improved the compatibility to javascript/actionscript. There are several new keywords which are basicly ignored ("static" and "var"). It was not meant to be used for other servers though, it could be possible to add a check for still allowing them as normal variables.
But why would it give out errors if you do something like temp.var? That shouldnt happen. Last time I checked. temp.new or something similar didnt give out anything, too, and it worked. Please add some fix, I'm already scared something will happen to the NPC-Server and somebody has to restart it D:
Reply With Quote
  #18  
Old 03-21-2008, 10:47 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Stefan View Post
We have uploaded new versions of gserver and npcserver to the playerworld machines for fixing the problem with a playerworld that was lagging a lot. There are a few modifications to the scripting: it is much faster now and we've improved the compatibility to javascript/actionscript. There are several new keywords which are basicly ignored ("static" and "var"). It was not meant to be used for other servers though, it could be possible to add a check for still allowing them as normal variables.
Please do that, I use 'var' several times in the mudlib. There is also the fact that I have a global object on clientside and serverside named 'static' which I place many global variables (such as objects) that would be broke if they were viewed/saved in text format.

Stefan I would love if you'd give us a bit of warning ahead of time before you do something like that :/
__________________
Reply With Quote
  #19  
Old 03-21-2008, 10:51 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 Stefan View Post
We have uploaded new versions of gserver and npcserver to the playerworld machines for fixing the problem with a playerworld that was lagging a lot. There are a few modifications to the scripting: it is much faster now and we've improved the compatibility to javascript/actionscript. There are several new keywords which are basicly ignored ("static" and "var"). It was not meant to be used for other servers though, it could be possible to add a check for still allowing them as normal variables.
You should think about making an option BEFORE you do it, not after.
__________________
Reply With Quote
  #20  
Old 03-21-2008, 11:35 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Yeah, the var seems to be a new update, but I don't seem to understand why it's needed, like why do we need a new type? >:[

Well, I finished rescripting everything so it didn't use 'var' some hours ago.. Took me 1 hour to look for a bug I thought was there (wasn't loading vars into a object, seemed that I was using "SCRIPT 2" and I had to edit it to work.. =/)

SCRIPT 2
PHP Code:
temp.file.loadvars("mud/archetypes/"arch @".txt");
for(
temp.var : file.getdynamicvarnames()) {
  ...
  
this.(@var) = file.(@var);

So I just changed all 'var' into 'var2'..
Still, it's kinda annoying that there's no changelog, no notice about it, but a random update no one knew about.. (Happened about 22-23 hours ago)


And about more support for javascript, why did you add var type from javascript? :o
__________________
Reply With Quote
  #21  
Old 03-22-2008, 12:24 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Didn't know that many people are restarting their npcservers all the time. You can still use "temp.var" but not "var" alone. I will check if we can add a fix or make it optional. The new npcserver version is only on the machines for private or hosted servers, not for gold or classic.
If your server has problems then look into logs/syntaxerrors.txt
Reply With Quote
  #22  
Old 03-22-2008, 12:41 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
Didn't know that many people are restarting their npcservers all the time. You can still use "temp.var" but not "var" alone. I will check if we can add a fix or make it optional. The new npcserver version is only on the machines for private or hosted servers, not for gold or classic.
If your server has problems then look into logs/syntaxerrors.txt
Its not only about restarting the NPC-Server. Also, if I use temp. variables, I often leave the temp. off when using it. For example, I declare temp.var (for example its 5) and then do math stuff with only var. Thats probably the biggest problem here. Maybe you can answer why we need var and static to be keywords?
Reply With Quote
  #23  
Old 03-22-2008, 01:48 AM
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
This is for JavaScript/ActionScript compatibility. `var` in either of these is akin to temp. and static is a `function` qualifier. We don't need it, unless we want to use ActionScript 3. Seems good enough for me.

Quote:
Originally Posted by Stefan
We have decided to change the plan a little bit. We will improve the Graal engine to make it easier to reuse Flash scripts (action script 3). [...] it makes it easier in the future to reuse flash script or let flash scripter make games for Graal.
e: So I guess I should say (since it probably makes more sense), Stefan is saying that e.g. the ActionScript
PHP Code:
static function foo() {
  var 
bar "baz";
  return 
bar;

The static/var keywords here are ignored so that the graal engine can handle it. So your errors would arise from var being ignored (you'd have no legal lvalue in assignment thru var = "something").
__________________
◕‿‿◕ · 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; 03-22-2008 at 01:59 AM..
Reply With Quote
  #24  
Old 03-22-2008, 01:56 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
There is also support for dots in class names and "import" and an extension to the new constructor, but like i said its more experimental. It's basicly for easier cut & paste of existing scripts. The keywords "var" and "static" are currently ignored, so when you start a code line with those words it is ignoring them and of course seeing an error in the following script. It's possible to switch the npcserver back to the old version until that problem is fixed, if it's really a big problem.
Reply With Quote
  #25  
Old 03-22-2008, 05:03 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Jesus guys, why don't you just name your damn variables as v instead of var? I rarely use temp variables that are more then 2 letters in length.

Also, just script scan, F3 and ctrl+v a bunch of times and your var problem is fixed (be sure to enable fullword only).

I've replaced variable names on my whole server many times and it only took me about 5 minutes tops to replace about 70 instances or so.
__________________
Do it with a DON!
Reply With Quote
  #26  
Old 03-22-2008, 05:06 AM
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 zokemon View Post
I rarely use temp variables that are more then 2 letters in length.
Same, but I'll name this. variables and others better.
__________________
Reply With Quote
  #27  
Old 03-22-2008, 05:30 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by cbkbud View Post
Same, but I'll name this. variables and others better.
Me too! Let's start a club.
__________________
Do it with a DON!
Reply With Quote
  #28  
Old 03-22-2008, 06:35 AM
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 zokemon View Post
Me too! Let's start a club.
OK!
__________________
Reply With Quote
  #29  
Old 03-28-2008, 12:45 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Ok the npcserver has been updated, you can now use "var" as function parameter and variable name again. The built-in values "NULL", "true", "false" and "pi" also work as function parameter names again instead of displaying an error.
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 12:41 AM.


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