Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Variable Handling Revision (https://forums.graalonline.com/forums/showthread.php?t=76272)

Inverness 08-14-2007 05:36 AM

Variable Handling Revision
 
Variables in Graal are handled weirdly and I would like a server option available to change them into a form I think is better.

For the first thing, when you're trying to reference a variable without a prefix, I think there should be 4 places it looks.

#1. temp. variables
#2. this. static variables
#3. this. dynamic variables
#4. global variables

It would be returning the first one it finds.

Also when you're declaring variables without a prefix, I believe it should look for an existing variable in that same order, and if it can't find one, it should default to temp. not a global variable.

Of course that leaves the question, how are you going to declare global variables if the no-prefix defaults to temp.? Well in the function profiler and certain unusual scripting error messages, I noticed the prefix universe. I believe that prefix would be a good choice for declaring new global variables. Of course they could still be referenced without the universe. prefix if there are no temp. or this. variables of the same name.

Also note that dynamic variables are case-sensitive when static variables aren't, from my limited observations that is.

Edit: Would also be nice if there was some way to list the global dynamic variables. (Object names and things) Do I know if I'm overwriting something or not by using a global reference.

Angel_Light 08-14-2007 05:37 AM

second this. ;]

zokemon 08-14-2007 06:53 AM

Then every script would have to be changed. You could somewhat avoid this by making it so the use of new skips the "temp." stage but it still could mess a ton of scripts up that declare global variables.

Inverness 08-14-2007 04:39 PM

Quote:

Originally Posted by zokemon (Post 1339882)
Then every script would have to be changed. You could somewhat avoid this by making it so the use of new skips the "temp." stage but it still could mess a ton of scripts up that declare global variables.

Quote:

Originally Posted by Inverness (Post 1339874)
Variables in Graal are handled weirdly and I would like a server option available to change them into a form I think is better.

Way ahead of you dude. :p

I know that it could mess things up so thats why it would be a server option (requireng an npcserver restart on change) to people can switch to that format if they wish.

If such an option deals with the compiler then I suppose it wouldn't require a restart to set it, the compiler would just need to check the option on each compile.

Chompy 08-14-2007 08:53 PM

I totally second this

zokemon 08-15-2007 01:12 AM

Quote:

Originally Posted by Inverness (Post 1339953)
Way ahead of you dude. :p

I know that it could mess things up so thats why it would be a server option (requireng an npcserver restart on change) to people can switch to that format if they wish.

If such an option deals with the compiler then I suppose it wouldn't require a restart to set it, the compiler would just need to check the option on each compile.

Ahh my bad, must have missed that. Good idea, yes!

zokemon 08-16-2007 03:50 AM

I doubt he will be able to add this soon though since he is very busy with other updates for the client (like the playerlist lag bug).

Tyhm 08-17-2007 06:33 AM

We have a lot of issues like this: This or That would be better, but require completely rewriting the language...and thus completely rewriting every script on every server...I say do it, but release a Converter. A couple years after the release of Serverside we figured out there was a potential algorythm to convert it all...but Classic was already dead...really, priorities ought to go the other way around...

MysticalDragon 08-17-2007 06:10 PM

10thed http://graalonline.biz/images/smilies/1.gif

Admins 08-17-2007 09:31 PM

It could be interesting to add options to change the variable lookup, it wouldn't need to restart the server, but it would also need something to tell the client to change the variable lookup as well, at least for the local scripts. A disadvantage could be that scripts wouldn't be compatible between servers and it would be confusing if people post script examples which have different variable lookup. May be there should be a script line //#VARIABLEPREFIX2 or so at the start of the script.

Twinny 08-17-2007 09:49 PM

It would also be awesome if you implemented private variables.... atleast for the serverside portion.

Inverness 08-18-2007 02:21 AM

Quote:

Originally Posted by Stefan (Post 1340996)
It could be interesting to add options to change the variable lookup, it wouldn't need to restart the server, but it would also need something to tell the client to change the variable lookup as well, at least for the local scripts. A disadvantage could be that scripts wouldn't be compatible between servers and it would be confusing if people post script examples which have different variable lookup. May be there should be a script line //#VARIABLEPREFIX2 or so at the start of the script.

Ah, that looks like a better idea than the server options. Would you be able to implement it? I'd really love to have variables default to temp and not global :)

Inverness 08-26-2007 08:22 AM

Bump?

Twinny 08-26-2007 09:01 AM

Quote:

Originally Posted by Inverness (Post 1343175)
Bump?

Why bump? It seems he considered it.

Horrified 08-26-2007 05:00 PM

Quote:

Originally Posted by Twinny (Post 1343188)
Why bump? It seems he considered it.

I guess he wants more opinions.

Inverness 08-27-2007 11:07 AM

Quote:

Originally Posted by Twinny (Post 1343188)
Why bump? It seems he considered it.

Well I'd like to know if its something simple enough to be included in the next version or something. I'm just wanting to know if he is actually going to do it.

zokemon 08-27-2007 11:40 AM

I doubt anything short of bug-fixes will be in the next version.


All times are GMT +2. The time now is 06:10 AM.

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