Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   KSI-GS (Coding Standards) (https://forums.graalonline.com/forums/showthread.php?t=46557)

Kaimetsu 09-14-2003 04:01 PM

Quote:

Originally posted by GoZelda

Wrong. You can use any letter, as long it isn't used (x,y,z).
I,j,k,l etc. is for compability with Java and C++, just like == is.

Wrong. Those variable names are used simply for the sake of uniformity. Compatibility isn't even a factor.

Tseng 09-14-2003 04:11 PM

Quote:

Originally posted by GoZelda

I,j,k,l etc. is for compability with Java and C++, just like == is.

AHAHAHAHAHAHAHA

GoZelda 09-14-2003 04:34 PM

Quote:

Originally posted by Kaimetsu


Wrong. Those variable names are used simply for the sake of uniformity. Compatibility isn't even a factor.

o.O crappy Java tutorial. Crappy NPCprogramming.RTF.
:grrr:

Tseng 09-14-2003 04:43 PM

Quote:

Originally posted by GoZelda

o.O crappy Java tutorial. Crappy NPCprogramming.RTF.
:grrr:

Dude, that has nothing to do with it. I don't think you fully understand the word 'compatibility'.

GoZelda 09-14-2003 04:48 PM

Quote:

Originally posted by Tseng


Dude, that has nothing to do with it. I don't think you fully understand the word 'compatibility'.

That could very well be XD

GoZelda 09-21-2003 04:01 PM

Quote:

Originally posted by Tseng


AHAHAHAHAHAHAHA

Quote:

Originally said by Stefan Knorr in NPCprogramming.rtf

You can also use other symbols like ":=" and a single "=" for checking equality, but it's not recommended (to keep compability to the Java/C++ syntax)

I'll get the for stuff later.

Kaimetsu 09-21-2003 04:13 PM

Quote:

Originally posted by GoZelda
I'll get the for stuff later.
English isn't Stefan's first language.

Anyway, i and j aren't part of Java or C and they're not syntactic devices. They're just variable names.

GoZelda 09-21-2003 05:35 PM

Quote:

Originally posted by Kaimetsu


English isn't Stefan's first language.

Nor is it mine, so i guess that's the reason of this... misunderstanding.

Admins 12-09-2003 02:40 PM

There is now a new command on RC:

/style scripttype name

Scripttype can be class, npc or weapon.
It is reformatting the script to look nicer. Please test it before using, sometimes triggeractions can be messed up because it divides weapon names like Day-Night in Day - Night. You can change the style options in the server options:

scriptstyle=spaces=2,padding=oper,brackets=attach

Spaces gives the number of spaces to put in front of each line (indenting).

Padding says where to put spaces in between:
'oper' will put spaces behind commands like 'if' and before and after operands like '+' and '==',
'paren' will put spaces in [] and (),
'all' will do both.

Brackets says if it should break lines before and after { and } ('break'),
or if it should actually attach it to the previous 'if' or 'for' command ('attach'). Use 'linux' as option if you want to break declarations (array declarations like a = {1,23}) but want to attach brackets after commands.

The npcserver uses the astyle library to format the text.

[edit: post merge by Loriel :cool:]

Yes i,j,k is common standard for loop index variables. The 'l' is not used often because it looks like a 1. So better continue with m,n,o,p,q,r,s,t etc. :)

osrs 12-09-2003 05:10 PM

Quote:

Originally posted by Stefan
There is now a new command on RC:

/style scripttype name

Scripttype can be class, npc or weapon.
It is reformatting the script to look nicer. Please test it before using, sometimes triggeractions can be messed up because it divides weapon names like Day-Night in Day - Night. You can change the style options in the server options:

scriptstyle=spaces=2,padding=oper,brackets=attach

Spaces gives the number of spaces to put in front of each line (indenting).

Padding says where to put spaces in between:
'oper' will put spaces behind commands like 'if' and before and after operands like '+' and '==',
'paren' will put spaces in [] and (),
'all' will do both.

Brackets says if it should break lines before and after { and } ('break'),
or if it should actually attach it to the previous 'if' or 'for' command ('attach'). Use 'linux' as option if you want to break declarations (array declarations like a = {1,23}) but want to attach brackets after commands.

The npcserver uses the astyle library to format the text.

[edit: post merge by Loriel :cool:]

Yes i,j,k is common standard for loop index variables. The 'l' is not used often because it looks like a 1. So better continue with m,n,o,p,q,r,s,t etc. :)

Finally!
But a style button wouldn't be better?

Loriel 12-09-2003 06:37 PM

A style button would have required yet another RC update, and would also need to be rescripted for the new RC later on. Also, I doubt it would do much good to the RC's compactness to link it with the library Stefan mentioned.
Edit: Actually, no. Forget that. A style button would be better.

VeX_RaT_Boy 12-10-2003 01:22 AM

Finnaly! Good job Stefan :)

But, yea, A style button would be better;)

xPuppetMasterx 12-10-2003 01:33 AM

Very nice. This will come in handy. :)

xManiamaNx 12-10-2003 01:56 AM

Wait for the new scripted rc, then you'll be able to have style buttons ;)

ForgottenLegacy 12-10-2003 06:18 AM

What are the options to have the same style that Stefan uses when he scripts? Fourm PM this to me please, as I never read this thread much.
NPC Code:

if (created) { //Braces on the same line, 1 space after the )
operations(); //Next command is on another line, alone, 2 spaces indented;
if (myflag) {
operations(); //Embedded command is 2 spaces indented, added to the origional 2 spaces
} // Closing brace on it's own line
}



All times are GMT +2. The time now is 12:41 AM.

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