Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-30-2007, 11:53 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
Uh, I do this for the simple fact that I'm damn tired of typing temp. before every variable name, no other reason. I also like it better without temp., its more pretty like that. Also shortens the code in the long run.
__________________
Reply With Quote
  #2  
Old 03-30-2007, 11:54 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Inverness View Post
Uh, I do this for the simple fact that I'm damn tired of typing temp. before every variable name, no other reason. I also like it better without temp., its more pretty like that.
Hm, in my opinion, it is better to always prefix variables. That way, there is no confusion as to which scope you are working in.

I try to write my scripts for people who have to work with them as well as for myself.
__________________
Skyld
Reply With Quote
  #3  
Old 03-30-2007, 11:55 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 Skyld View Post
Hm, in my opinion, it is better to always prefix variables. That way, there is no confusion as to which scope you are working in.

I try to write my scripts for people who have to work with them as well as for myself.
For myself, I only do this no-prefixing thing for temp variables, like how local variables in Java usually go without a prefix. So there is no confusion for myself. But also, all the temp variables are declared at the beginning so you know them already.

Edit:
I would like it if un-prefixed variables defaulted to temp. rather than a global if no previous temp. or this. variables were found.
__________________
Reply With Quote
  #4  
Old 03-30-2007, 11:59 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Inverness View Post
For myself, I only do this no-prefixing thing for temp variables, like how local variables in Java usually go without a prefix. So there is no confusion for myself. But also, all the temp variables are declared at the beginning so you know them already.
My point is not so much whether it's solely clear to you, but also to other people who are reading the script who might not be as good at scripting as you or I. A lot of people have difficulty getting their heads around variable declarations, and even more people have difficulty identifying differences between scopes. If everything temporary is prefixed, there's no confusion. If you list things as temp. and then don't use temp. in the rest of the function, that seems slightly misleading. :|

There's more to styling than whether it looks pretty or not; it's about catering for other people who may wish to edit the script or read it. It's for that reason that we prefer people to style scripts before posting asking for help with them here.
__________________
Skyld
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 04:32 PM.


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