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
  #31  
Old 08-11-2003, 05:39 AM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
I like to use b in my for loops. But anyways..

I think it should be added where code should be layered according to how how it's used. For example:

NPC Code:

if (strequals(#a,SaijinGohan)) {
if (strequals(#g,Bravo Legends)) {
say2 Yay!;
}
}



The above is properly 'layered'.

NPC Code:

if (strequals(#a,SaijinGohan)) {
if (strequals(#g,Bravo Legends)) {
say2 Yay!;
}}



The above is not properly 'layered'.

Thats my little pet peeve. It just seems easier to help people when its that way.
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #32  
Old 08-11-2003, 05:49 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
That's just a stylistic choice. The underlying code will be exactly the same either way.
__________________
Reply With Quote
  #33  
Old 08-12-2003, 06:53 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
good god.. dont get into where to put brackets... we all have differant styles of scripting... i for one hate my damned enter key and weasal out of "layering" any chance i get...
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #34  
Old 08-12-2003, 04:45 PM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Ok fine but I still think it's easier with some kind of format.
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #35  
Old 08-12-2003, 09:32 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Kai said he'd think about how to phrase this after I told him, but he never posted soooo, in the deprecated commands section:
Don't use toweapons unless you're making the script on a server without an NPCserver, OR EVIL MONKEYS FROM THE DEPTHS OF HELL WILL COME ABOVE GROUND AND EAT YOUR SOUL.
__________________

Reply With Quote
  #36  
Old 08-12-2003, 09:34 PM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by CheeToS2
Kai said he'd think about how to phrase this after I told him, but he never posted soooo, in the deprecated commands section:
Don't use toweapons unless you're making the script on a server without an NPCserver, OR EVIL MONKEYS FROM THE DEPTHS OF HELL WILL COME ABOVE GROUND AND EAT YOUR SOUL.
I requested a disabletoweapons=true serveroption (or it to be globally disabled with the exception of classic). Stefan said he would consider the server option.
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #37  
Old 08-12-2003, 10:18 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Tseng


I requested a disabletoweapons=true serveroption (or it to be globally disabled with the exception of classic). Stefan said he would consider the server option.
or just be careful =|
Reply With Quote
  #38  
Old 08-12-2003, 10:29 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
Mleh. Classic is supposed to be getting a conversion. So all the more insentive to hurry it up.
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #39  
Old 08-13-2003, 01:30 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by Python523

or just be careful =|
That really works when stupid Levels Team members get the idea to try to add a weapon with a name that already exists?

That really works when old backup levels with toweapons are added and played on?

:-\
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #40  
Old 08-16-2003, 08:39 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
i agree with tseng... ive uploaded old levels and found "toweapons" in there... had a good time getting disconnected about 7 times before i realized it was there too
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #41  
Old 08-16-2003, 08:42 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by wonderboysp2p
i agree with tseng... ive uploaded old levels and found "toweapons" in there... had a good time getting disconnected about 7 times before i realized it was there too
I'm talking about serverside toweapons (overwrites weapons in NC), not clientside toweapons (disconnects because clientside/offline style toweapons is the kind of thing trainers inject to try to add a weapon).
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #42  
Old 08-17-2003, 05:26 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
ooooooooooooooooooooooooooooooooooooooooooh
that's another problem heh
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #43  
Old 08-17-2003, 03:58 PM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
It is good to see people who know that programming is an art form, and there are certain rules that should apply for asthetic reasons, and to save on processor time (thus slashing away at the lag monster).

Good code should be self-documenting, but comments are encouraged - at least a purpose statement, like with your graal name and an exploination of what the npc does, at the top of the code.

There are two ways to make comments, line at a time, and in a block.

NPC Code:

// NPC by Prozac
// This npc is uber 1337 and will ownz all of joo!
// this line is a comment and will not be read by the parser

///////// text lines like this help break up long scripts ///////

// for short query-action stuf like the code below
// I think its ok to put it on one line . less scrolling
// in the code window too.

if (playerenters) {message I Ownz joo!;}

a=0; //variable a is set to 0: after the two slashes is a comment until you press enter





The comments that go on for more than one line should be put in a comment block

NPC Code:

/* NPC by Prozac
This npc shows how I prefer to layout code after querying for a
comdition, then listing more than one command.

I like to have the curly brackets on their own line
at the start and end of the blocks, two spaces in if nested condition checks.

In long scripts or blocks of code, I place and indent my if
(condition) and brackets { and } beforehand, then fill in the
commands afterwards. This habit helps to make sure you don't
forget to close your brackets, that they end in the right place.

A good indentation rule is two spaces, thats what I usually end
up doing. But as in all art, try the general convention, then find what works for you.

And yes, all this is a comment. Here comes the comment end..
*/

//////// code begins here //////////

if (created)
{
setplayerprop #c,I am here!;
a=0;

if (weaponsenabled)
{
say2 Weapons are enabled;
}

}




Forgive spelling or grammar mistakes, as its early morning and am half awake .. and half asleep .. so my consiousness is twice as big as it needs to be?
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #44  
Old 08-18-2003, 05:46 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
heh my dad's always telling meh to use comments while programming... it's fun because you can pretend that whateber you put is a sublimnal message repeated OVER AND OVER while the script is functioning but yea...

comments are very underused in gscript (as far as ive seen)... i think it would be ince to see a script once in a while that ya know says

if (actionjewer){
message #p(1) Is A Jew!; //#p(1) is the player's account name
}

or something like that, so we have like a little helper when we're debugging other people's scripts... or scripts we made when we were "in a state where we wouldnt remember" heh...

most scripters can easily identify (looking at the triggeraction) that #p(1) would be the players account name but it saves time and is much easier to just look to the right and say "oh!"

or say, the script keeps coming up with something like
"12 is a jew!" people can say "hmm..."
"oh ok well that's the problem! #p(1) is scripted to be the players damage! they have 'account name' listed as #p(2) in the triggeraction! Silly NATs..."

it can cause more confusion if someone types the wrong thing as a comment then what the script is actually intended to do but everything's got drawbacks right?
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #45  
Old 08-22-2003, 02:32 PM
duzzel duzzel is offline
Registered User
Join Date: Aug 2003
Posts: 20
duzzel is on a distinguished road
another word for scripting hmm...geek
anyways I wish there were a good tuturial that teaches people to script easier... i just don't get it
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 07:10 PM.


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