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 01-23-2008, 03:15 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
I think the best solution for private variables is just treating them as private. The convention you use for denoting a private variable could help you.

I basically treat all variables as private / local, and use clearly-defined functions to modify them.
Reply With Quote
  #2  
Old 01-23-2008, 05:58 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
Quote:
Originally Posted by Novo View Post
I think the best solution for private variables is just treating them as private. The convention you use for denoting a private variable could help you.

I basically treat all variables as private / local, and use clearly-defined functions to modify them.
Yea I do it about the same way. I see private variables as more of a way of making the script idiot-proof so people other than yourself don't mess it up.
Quote:
Originally Posted by cbkbud View Post
What is thisor exactly?
Well if you used thisr. to reference private variables in the object, then what about when you're in a with (object) {} block and want to get a private variable from the calling object? Normal variables would be accessed by thiso. but you would need something thisor. for the private variables of the parent object and that is just unnecessary.
__________________
Reply With Quote
  #3  
Old 01-24-2008, 09:28 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 Inverness View Post
Normal variables would be accessed by thiso. but you would need something thisor. for the private variables of the parent object and that is just unnecessary.
This circumvents the privacy.

im in ur scope accezzin ur private variablez.
__________________
◕‿‿◕ · 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
  #4  
Old 01-25-2008, 12:46 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
Quote:
Originally Posted by Tolnaftate2004 View Post
This circumvents the privacy.

im in ur scope accezzin ur private variablez.
The original object is still executing the code, not the object in the with () block, so its not circumventing it.

I remember Stefan saying quite along time ago that something like thisr. would not be such a good idea so any argument is pointless.
__________________
Reply With Quote
  #5  
Old 01-25-2008, 03:47 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 Inverness View Post
The original object is still executing the code, not the object in the with () block, so its not circumventing it.
thisor.var = thisr.var; or thisr.var = thisor.var; in a with block would be circumventing it.

e: I think you may have misunderstood Stefan, too.
The last post wasn't meant to single you out, but after I posted, I realized how much of a pain it would have been to get my point understood.
__________________
◕‿‿◕ · 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; 01-25-2008 at 03:59 AM..
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:49 PM.


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