Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Learn to script! (https://forums.graalonline.com/forums/showthread.php?t=134263069)

papajchris 05-03-2011 02:37 AM

I think you misunderstood ms. I mean 3 or 4 new classes a year. Each class will have weekly assignments. Think of it as highschool where each new class Is incoming freshman. As new classe come in the old ones will help teach them but also continue learning to script. Ideally the assignments never stop, just keep getting harder. Missing an assignment is in no way a problem.

Edit: I just realized that when I'm saying classes I should be saying groups. Class is every week, and 3 or 4 groups will join the "school" a year. Does that make sense :p

Rave_J 05-03-2011 02:50 AM

yup umm papa can u priviate message me about how to set up google wave ect i only use teamspeak and vent i never even heard of google wave

papajchris 05-03-2011 02:58 AM

I'll just tell everyone here.

Once you have a gmail email, go to wave.google.com and make an account. Let me know some how (forum pm, in this thread, etc.) that you did that and i can add you to the roster.

Again, the initial sign up may annoy some, but bare with me as we try this. After experimenting with it with some others, it seems quite efficient.

Devil_Lord2 05-03-2011 03:02 AM

Quote:

Originally Posted by papajchris (Post 1647246)
I think you misunderstood ms. I mean 3 or 4 new classes a year. Each class will have weekly assignments. Think of it as highschool where each new class Is incoming freshman. As new classe come in the old ones will help teach them but also continue learning to script. Ideally the assignments never stop, just keep getting harder. Missing an assignment is in no way a problem.

Edit: I just realized that when I'm saying classes I should be saying groups. Class is every week, and 3 or 4 groups will join the "school" a year. Does that make sense :p

It sounds like it is going to take a loooot of people to keep this up lol

cbk1994 05-03-2011 03:02 AM

Punctuation should be a requirement for joining the group.

papajchris 05-03-2011 03:07 AM

Quote:

Originally Posted by Devil_Lord2 (Post 1647253)
It sounds like it is going to take a loooot of people to keep this up lol

Not really, and i have no intention of leading all the other groups. My hope is that groups form and follow in our footsteps. As long as another person wants to learn with me, im satisfied. I am just trying to create a network.

papajchris 05-03-2011 04:07 AM

Okay sorry to do this, but I think a forum would be better than google wave. I say this because its easier for people to sign up and join and its easier to show threads to non members.

Please take a minute to check out http://scriptingschool.forumotion.com/.

This will not change, so don't worry. Sorry about the confusion.

I put up a mini practice script (pretty simple) Under Assignments/Week One. You can see the instructions on top and then see posts below. Feel free to comment on people's scripts (I put a simple script up to show you). If you need help, go to the help section.

oo_jazz_oo 05-03-2011 05:12 AM

Also, as you have different lessons, its important to teach good styling.

PHP Code:

function onCreated() {
  echo(
"Hello World!");


is much better than
PHP Code:

function onCreated(){echo("Hellow World!");} 

Or any other variation, as people like to do weird stuff while styling...
It just makes it easier for others to read your code.

Also, indenting the script inside a function/brackets makes it much easier to read than if everything is indented the same. :P

Devil_Lord2 05-03-2011 08:37 AM

Quote:

Originally Posted by papajchris (Post 1647269)
Okay sorry to do this, but I think a forum would be better than google wave. I say this because its easier for people to sign up and join and its easier to show threads to non members.

Please take a minute to check out http://scriptingschool.forumotion.com/.

This will not change, so don't worry. Sorry about the confusion.

I put up a mini practice script (pretty simple) Under Assignments/Week One. You can see the instructions on top and then see posts below. Feel free to comment on people's scripts (I put a simple script up to show you). If you need help, go to the help section.

Can you post assignments on here since my subscription is on here and I can see if someone replies, then I can head over to there? Because I honestly don't think I will check weekly or bi-weekly and will probably forget in a few weeks to even check it..

I'll check it now though! :]

Quote:

Originally Posted by oo_jazz_oo (Post 1647275)
Also, as you have different lessons, its important to teach good styling.

Also, indenting the script inside a function/brackets makes it much easier to read than if everything is indented the same. :P

Oh geez, I have when people do
PHP Code:

function onHurtMyBrain(){ 
  
below "horribleimo";
  if (
youDoItLikeThis){
    
this.confusedMe "a lot.";
  } else { 
  
something below;
  }

or if (
wheredthebracketsgo)    what ++; 

or such.. I've never been taught to do it, and seeing others doing it I say it is bad styling.. But then I saw that Stefan does it in his 2001 baddies.. D: I had to tell ZeroG I'd never criticize on him doing it again. :c

Also, I hate that foo bar stuff as well >.> for all I know it is a built in variable or function I don't know about or care to learn.

Anyway, sometimes the simplest scripts can confuse you when you are not use to the styling or if the styling is poor... :cry:


Quote:

Originally Posted by cbk1994 (Post 1647254)
Punctuation should be a requirement for joining the group.

Or anyone who is willing to learn from their mistake or at least try..
I don't think anyone should be left out because of lack of knowledge if they really want to, and can, learn. :c
Then again, I don't recommend anyone to try if they do not have Access to RC... D:
Although, I think I know someone trying to build a program to check code like the RC does..
It would be extremely helpful.

Tricxta 05-03-2011 09:15 AM

Whats peoples on thoughts as far as readability goes if I did:
NPC Code:
function onCreated()echo "Hello world!";



I think it improves readability as its a smaller area to focus on however some might argue it decreases readability, can someone please clarify this?

cbk1994 05-03-2011 11:53 AM

Quote:

Originally Posted by Tricxta (Post 1647299)
Whats peoples on thoughts as far as readability goes if I did:
NPC Code:
function onCreated()echo "Hello world!";



I think it improves readability as its a smaller area to focus on however some might argue it decreases readability, can someone please clarify this?

The most important thing is consistency. However, I don't think there's a scripter who wouldn't smack you for doing that, especially since the echo is GS1. It doesn't improve readability to exclude braces, it just makes it harder to change later.

PHP Code:

function onCreated() {
  echo(
"Hello world!");



Tricxta 05-03-2011 12:03 PM

Is there any website that contains all the commands available to use in GS2? And Gscript wiki isnt it, it contains the basics and only the basics, nothing like how to disable the chat bar or something obscure. Or is everything just thrown around everywhere and is a complete mess?

cbk1994 05-03-2011 12:28 PM

Quote:

Originally Posted by Tricxta (Post 1647312)
Is there any website that contains all the commands available to use in GS2? And Gscript wiki isnt it, it contains the basics and only the basics, nothing like how to disable the chat bar or something obscure. Or is everything just thrown around everywhere and is a complete mess?

GScript is object-oriented, so you want to get away from thinking of it as command-based. To disable the chat bar, you need to act on its GUI object, named ChatBar.

There is a list of server functions here, and a list of client functions here. These are not completely up-to-date, so use scripthelp as well.

Emera 05-03-2011 02:47 PM

Quote:

Originally Posted by PhilSmith (Post 1647221)
Also, being the first to try this could be difficult. This dummy group needs to get. It right or people will be hesitant to try it again. I don't think we will have that problem though, given the dedication of some of the members. Also, once we have a curriculum to base off of and the setup made, I don't see why other classes couldn't deviate from this (other NAT GANI, LAT or even GFX classes)

No pressure...
But i agree lol. I am looking forward to this!
i hope to see a lot of people there!

papajchris 05-03-2011 05:11 PM

The first assignment is already up (Well a practice one)! So sign up on the forums and post. Me and some others have already met on testbed and began working on making the practice assignment more complex. From this point on I am going to copy/paste our conversations (if they were productive) so that they could be used as a guide as many questions were asked. We will be on there tonight!

Good News! - I am looking into a ventrillo server strictly for those who want to script.

papajchris 05-03-2011 08:38 PM

I know this is a double post, but i'd like it to show up as an updated thread.

I'd like some input on what we will be working on. Right now I think it would be a great idea to work on a server pack (As many of you are starting servers). We will be working on a
  • Tailor system
  • Hat System
  • Jail System
  • Event System
  • Mining System
  • Custom HUD and Inventory
  • Event Prizes
  • Fishing

(Not necessarily in this order)

Now these cover a wide range of things. For example the hat system would start off as setting a players hat, and eventually creating a GUI for it (As Jerret talked about above). Same with the Tailor Script. These options cover a wide range of skill from simply setting a skin color to have a GUI that saves outfits.

My intention is to eventually compile worthy scripts and hand them out as Server Start-up Packs (What the GDT use to do) or training guides (Of course with the scripters permission).

IaMnOtAnEwB2_red38 05-03-2011 09:19 PM

This seems interesting, a few years ago I was in the middle of learning GS1 and I seemed to catch on quickly, but never gave myself a chance to pick it back up after the GS2 conversion. Count me in.

Email: [email protected]

fowlplay4 05-03-2011 10:40 PM

Sorry but that forum is just dreadful.

Couldn't you just use the Group (Moderated) functionality on these forums, and Thread posts for assignments/challenges?

Samurai_X2689 05-03-2011 10:41 PM

I always wanted to learn scripting and I have learned ssome scripting from my buddies on graal. However, I think this is a good opportunity for me to learn more and get better at scripting. So count me in. :D


E-mail: [email protected]

papajchris 05-03-2011 10:52 PM

Quote:

Originally Posted by fowlplay4 (Post 1647390)
Sorry but that forum is just dreadful.

Couldn't you just use the Group (Moderated) functionality on these forums, and Thread posts for assignments/challenges?

I was going through a few themes so hopefully you took a look while I was adjusting things. I personally like having it on a different website as all scripting things are in one place. Once a thread dies I plan to adjust the title to what the thread may be about (such as functions) and make it easy to search. I like the ability to make changes, but if it ends up not working we can come here

iBeatz 05-04-2011 12:08 AM

I've been scripting for a while on Graal now, but there are quite a few things that I feel I still do not understand fully, so sign me. :)

[email protected]

iBeatz 05-04-2011 12:08 AM

*sign me up

Devil_Lord2 05-04-2011 12:25 AM

Quote:

Originally Posted by Tricxta (Post 1647299)
Whats peoples on thoughts as far as readability goes if I did:
NPC Code:
function onCreated()echo "Hello world!";



I think it improves readability as its a smaller area to focus on however some might argue it decreases readability, can someone please clarify this?

I hate that! My first script I decided to work on was learning Dustys hammer and he did things sort of like that.. the missing brackets are the only reason I couldn't understand the parts I wanted to learn were
level.tiles[x,y];
and
updateboard(x,y,L,W);

I went through the script so many times trying to figure out the part of the script that did it only to realize it was two commands..

Then I made a beach. ^.^
But I've asked so many people to help me get what was doing it and no one could tell me..

Quote:

Originally Posted by cbk1994 (Post 1647316)
GScript is object-oriented, so you want to get away from thinking of it as command-based. To disable the chat bar, you need to act on its GUI object, named ChatBar.

There is a list of server functions here, and a list of client functions here. These are not completely up-to-date, so use scripthelp as well.

Is this better then commands.rtf? / the new GS2 server cammands file that was floating around somewhere on the forum?

Quote:

Originally Posted by Emera (Post 1647324)
No pressure...
But i agree lol. I am looking forward to this!
i hope to see a lot of people there!

It's already up, you should go to:
http://scriptingschool.forumotion.com/.


Quote:

Originally Posted by IaMnOtAnEwB2_red38 (Post 1647380)
This seems interesting, a few years ago I was in the middle of learning GS1 and I seemed to catch on quickly, but never gave myself a chance to pick it back up after the GS2 conversion. Count me in.

Email: [email protected]

I know exactly what you mean! It took me 2-3 months ago to start learning GS2 after learning GS1 about five years ago.. after Babylon died 'in my head apparently it carried on for a good amount of time' along with GS1, I gave up on trying to learn too.

Quote:

Originally Posted by fowlplay4 (Post 1647390)
Sorry but that forum is just dreadful.

Couldn't you just use the Group (Moderated) functionality on these forums, and Thread posts for assignments/challenges?

I agree.. It would be nice to have him as a moderator and our own thing on the forum.. I like the PHP system on here with the nice colors. ;o

Quote:

Originally Posted by papajchris (Post 1647393)
I was going through a few themes so hopefully you took a look while I was adjusting things. I personally like having it on a different website as all scripting things are in one place. Once a thread dies I plan to adjust the title to what the thread may be about (such as functions) and make it easy to search. I like the ability to make changes, but if it ends up not working we can come here

But I also agree with this... if he does do it on here, there is a chance it could 'die' and a lot of people would not want to post on it because of the so called 'proper etiquette' of this forum. I know I wouldn't want to be yelled at again for posting on a 'dead' thread that interests me and can annoy a whole lot of other people.. I think if he could manage his own subject / thread where we could post subforums inside of it, it could go well on here.

It would get all messy in only one or two threads..

Again, I'd rather post on here.. and greatly like the PHP system on here, but as he said, he'd at least be able to manage it on there. Perhaps this could be worked out?

MattKan 05-04-2011 02:22 AM

Quote:

Originally Posted by iBeatz (Post 1647416)
so sign me. :)

*engraves initials on head*

oo_jazz_oo 05-04-2011 02:27 AM

Quote:

Originally Posted by Devil_Lord2 (Post 1647425)
I hate that! My first script I decided to work on was learning Dustys hammer and he did things sort of like that.. the missing brackets are the only reason I couldn't understand the parts I wanted to learn were
level.tiles[x,y];
and
updateboard(x,y,L,W);

Actually, having single like script blocks within if() or loops is common.

The problem in this case is he was asking about a function without brackets.

PHP Code:

function onCreated() {
  if (
foo == bar) return true;
}
function 
onPlayerEnters() {
  for (
pl:players)
    
pl.chat "Welcome!";


Both of which are used commonly. At that point, I think its a matter of preference whether you include brackets for 1 line codes.

MattKan 05-04-2011 02:51 AM

I always script stuff like this...

PHP Code:

//instead of doing this:

function onCreated() {
  
commands
}

//I do this..

function onCreated()
{
  
commands


I've always done it, that's just the way I script, but do you think should get in the habit of doing it the first way?

papajchris 05-04-2011 03:26 AM

Hey everyone the ventrilo server just went up! go to scriptingschool.forumotion.com and its flashing on the home page! I'd post it here, but I am not sure if that is against the rules.

Tricxta 05-04-2011 03:31 AM

I think:
PHP Code:

onCreated(){



originated from gs1 which is what I still use

PHP Code:

onCreated()
{



Is kinda from languages like java and C#, I was only introduced to this style when my lecturers showed me this and threatened to take off marks if I didnt do it like that lol. I personally think the second way Is alot cleaner and yer new scripters should practice this style intead :)

Devil_Lord2 05-04-2011 03:45 AM

Quote:

Originally Posted by MattKan (Post 1647481)
I've always done it, that's just the way I script, but do you think should get in the habit of doing it the first way?

Up to you, but I've taken C Programming classes and learned the first way.. D: it may be a slight difference but the second way gives me a headache and confuses me sometimes.. even } else { lines too..

For anyone else who wants to comment along the lines of me not being able to read slight differences in code easily without strain.. I dropped out of Computer Science for Fine Arts. D:

So I no longer have to worry about it.. >_<


Quote:

Originally Posted by oo_jazz_oo (Post 1647478)
Actually, having single like script blocks within if() or loops is common.

The problem in this case is he was asking about a function without brackets..

:cry: I now hate the common folk, they are meanies.
I thought Dusty did it like that to confuse new people..

Oh well.. I guess I will have to work around it lol

Seich 05-04-2011 05:09 AM

Quote:

Originally Posted by Devil_Lord2 (Post 1647488)
Up to you, but I've taken C Programming classes and learned the first way.. D: it may be a slight difference but the second way gives me a headache and confuses me sometimes.. even } else { lines too..

For anyone else who wants to comment along the lines of me not being able to read slight differences in code easily without strain.. I dropped out of Computer Science for Fine Arts. D:

So I no longer have to worry about it.. >_<




:cry: I now hate the common folk, they are meanies.
I thought Dusty did it like that to confuse new people..

Oh well.. I guess I will have to work around it lol

The way you style your code is just personal preference. You can use whichever way you feel more comfortable. If you're working with other people it is recommended to be as clean as possible and to following a common styling guideline so that they can easily follow your code and that you can follow theirs.

oo_jazz_oo 05-04-2011 07:01 AM

There are many ways one can style code...some are just uglier (and wrong-er :3).

Such as putting brackets on their own lines. I used to do this, but I think it was GK who actually taught me not to. o_o
Putting brackets on their own lines increases line size, which isn't really a bad thing, its just unnecessary; but not necessarily wrong.

The only thing that irks me, is when people dont indent properly. >:[
PHP Code:

function onCreated() {
  
zomg();
  } 

Drives me crazy. Put the bracket on the indentation as the function declaration!
Because, if you do that all the time, you end up with very ugly scripts, especially if its not consistent.

PHP Code:

function onCreated() {
  
with (findplayer("Stefan")) {
    if (
player.hearts 3) {
    
player.chat "Hooray!";
      }
}
  } 

WTF is that. What. Is. That.

Clockwork 05-04-2011 08:32 AM

I'd love to try this out :)

Sign meh up.

Devil_Lord2 05-04-2011 10:36 AM

Quote:

Originally Posted by papajchris (Post 1647269)
Please take a minute to check out http://scriptingschool.forumotion.com/.

I put up a mini practice script (pretty simple) Under Assignments/Week One. You can see the instructions on top and then see posts below. Feel free to comment on people's scripts (I put a simple script up to show you). If you need help, go to the help section.

Sign up here. :]

cbk1994 05-04-2011 11:38 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1647478)
Actually, having single like script blocks within if() or loops is common.

The problem in this case is he was asking about a function without brackets.

PHP Code:

function onCreated() {
  if (
foo == bar) return true;
}
function 
onPlayerEnters() {
  for (
pl:players)
    
pl.chat "Welcome!";


Both of which are used commonly. At that point, I think its a matter of preference whether you include brackets for 1 line codes.

Please don't teach people to exclude braces for one-line statements :\. It's a hard habit to break, and it just makes it a pain when you try to change code later.

Chompy 05-04-2011 04:50 PM

For those of you who needs access to the Testbed Server, read this:

http://forums.graalonline.com/forums...21#post1647521


By providing everything I need to get your access up and running, that will be better for both. 60-70% people who ask me for access doesn't provide me with (enough) information I need to set up access :) Read the thread and you will!

Devil_Lord2 05-04-2011 07:35 PM

Hey Chompy, on the Graal news / F1 page it says:

"If you wish to participate, simply click here to fill out the submission form. (Be sure to include your email for contact information.) "


And when I click the link, it takes me to a

"Page not found

The page you request is not available on GraalOnline. We take in note to try to correct the problem. Please, back to home page

(Click here if your browser does not automatically forward you)
"

Page.


I don't know if it was linked bad, or not created yet, but I thought you should know..


Also, my friend ZeroG that I asked could get on Testbed a while ago, I forgot his gold ran out.. he can still do everything on the server he owns, so I guess he will work on his stuff there lol..

I just wanted him to come on Testbed since I can only work on Testbed with a classic account.. it gets lonely lmao. So, he doesn't need the access anymore, no longer a gold subscriber. D: I still appreciate it though. ^.^

papajchris 05-04-2011 07:55 PM

--Update ---
Sent in all the accounts who needed Access on testbed WHO filled out a form. If you replied in this thread I did NOT send your account. Please forum PM Chompy or Clockwork

fowlplay4 05-04-2011 08:04 PM

Aeko/Clockwork needs money for the Testbed server.

Quote:

Originally Posted by Clockwork (Post 1647549)
FYI: Testbed has 26 days before it has to be paid for again... and at 72$ it's not exactly cheap for someone w/o a job :P

Last time I got a little less than half, it'd be nice for the same to happen (tho only 2 people donated =.= )

Donate here

Considering the amount of support for this group, you guys should have an easy time helping him out in the process.

Devil_Lord2 05-04-2011 08:41 PM

Quote:

Originally Posted by fowlplay4 (Post 1647559)
Aeko/Clockwork needs money for the Testbed server.


Noooooo :'[

Quote:

Originally Posted by fowlplay4 (Post 1647559)
Considering the amount of support for this group, you guys should have an easy time helping him out in the process.

I hope so.. D:
I like the testbed server seeing it is the only server I am aloud to actually work on being classic..

I'd help out if I could, I'm not financially stable either.

oo_jazz_oo 05-05-2011 12:48 AM

Quote:

Originally Posted by cbk1994 (Post 1647507)
Please don't teach people to exclude braces for one-line statements :\. It's a hard habit to break, and it just makes it a pain when you try to change code later.

I dont see a huge problem in using one line codes without brackets for certain instances.
PHP Code:

function check(xy) {
  if (
== y) return true;


Like in that instance. Does it really make it any more readable...any more efficient...any more anything by adding the brackets?


All times are GMT +2. The time now is 01:45 PM.

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