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 09-04-2002, 04:41 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Formatting

What do you people see as the correct way to format a script?
I personally see it this way:

1 line:
if(playerenters) setcharprop #c,hi;

>1 lines:
NPC Code:

if(created||timeout){
i++;
setcharprop #c,#v(i);
timeout = .05;
}


What about you people? Maybe using correct formatting shouldn't be a rule but maybe encouraged to be used more often? I personally find it annoying to see scripts that aren't formatted that way =/
Reply With Quote
  #2  
Old 09-04-2002, 04:44 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
Ah, I think you're wrong, but i don't care. Correct is in the eye of the beholder x.X Here is what I do, and I find it QUITE easy to read and simple enough:
NPC Code:

if (created)
{ action 1;}

if (created)
{ action 1;
action 2;
action 3;
}


I think that it looks a bit more confusing when you have the opening { on the same line as the if statement. If you have a long if statement it gets harder to read =/
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #3  
Old 09-04-2002, 04:58 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
They teach you to seperate cold blocks from the conditional statements... Personally I find that quite confusing to do
NPC Code:

if(pie)
{
blah;
bahhiho;
}


I do
NPC Code:

if(only_one_command) do something like this;

and

if(more_than_one_command) {
do;
stuff;
like;
this;
}

__________________

subliminal message: 1+1=3
Reply With Quote
  #4  
Old 09-04-2002, 05:01 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
NPC Code:

if (something){
this;
because;
i_find;
it;
neater/easier to read;
}


Last edited by Torankusu; 09-04-2002 at 05:44 AM..
Reply With Quote
  #5  
Old 09-04-2002, 05:29 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
I prefer the "graal style" like what falcor, python, and torankusu did, but it doesn't make much difference as long as it is indented properly so I can read it.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #6  
Old 09-04-2002, 05:43 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Quote:
Originally posted by Dach
I prefer the "graal style" like what falcor, python, and torankusu did, but it doesn't make much difference as long as it is indented properly so I can read it.
i did indent, but I didn't use [code] so it didn't show.
Reply With Quote
  #7  
Old 09-04-2002, 06:10 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally posted by Torankusu
i did indent, but I didn't use [code] so it didn't show.
I wasn't refering to you personally.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #8  
Old 09-04-2002, 07:20 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Quote:
Originally posted by Dach


I wasn't refering to you personally.
I figured I'd fix it anyway.
Reply With Quote
  #9  
Old 09-04-2002, 07:26 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Re: Formatting

Quote:
Originally posted by Python523

NPC Code:

if(created||timeout){
i++;
setcharprop #c,#v(i);
timeout = .05;
}


that way
Reply With Quote
  #10  
Old 09-05-2002, 08:39 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
I personally use this style:

NPC Code:

if (blabla) {
commandhere;
}



Even if it is only one command, I use { }'s.
__________________
[signature]insert here[/signature]
Reply With Quote
  #11  
Old 09-05-2002, 08:48 AM
bigkow44 bigkow44 is offline
Registered User
bigkow44's Avatar
Join Date: Dec 2001
Location: Inside my head.
Posts: 610
bigkow44 is on a distinguished road
NPC Code:
if (1action) {command;} 
else
if (>1action) {
Command1;
Pie;
}

__________________
Reply With Quote
  #12  
Old 09-06-2002, 04:06 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
LOL, I seem to be the only one who doesn't put the { on the statement =/ Oh well, mine is still easy to read due to I indent. Regardless if there is only one command, I almost ALWAYS try and put in { and } so that in case I need to edit it l8er I won't have to add them.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
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 12:58 AM.


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