Tutorial for Anyone :) Even if your 12 and can read..

View previous topic View next topic Go down

Tutorial for Anyone :) Even if your 12 and can read..

Post by zunder on Tue Apr 12, 2011 10:37 am

COMMENTS
; This is a comment
Anything with a semicolon in front of it gets ignored when the script runs.

WHITESPACE
Added whitespace along the same line has no effect on the script. For example, these commands are all the same:

goto(:label:)
goto (:label:)
goto( :label: ) ;This is a comment
ifAt( x , y)
ifAt (x,y)

STRINGS AND STRING CONCATENATION
Strings
Any strings must have quotation marks around them. Names of items, objects, and NPC's are not considered strings, and will cause an error if delimited by quotation marks. Here are some examples:

print(Hi there!) <- This would cause an error
print("Hi there!") <- The correct way
attack("man") <- wrong way
attack(man) <- right way

Concatenation
The addition "+" charcter is the string concatenation operator. Here is an example:

print("hello " + "there!") output: Hello there!
print("Nice to meet you " + $var4) output: Nice to meet you [value of $var4]

LABELS
Labels look like this:

:label:

use them with goto(:label:) commands to control the flow of your script.

IF...COMMANDS
IF... commands can be followed by any other SINGLE command, so long as it's not another if....command

ifAt(x, y) goto(:label:) <-CORRECT
ifAt(x, y) say("I've Arrived!") <-CORRECT
ifAt(x, y) say("I've Arrived!") goto(:label:) <-WRONG

if... commands must be on the same line. Use them to control the flow of your script.

LOGICAL NOT OPERATOR
Simply placing the word "not" in any of your script commands reverses its logic. Here is an example:

ifAt(x, y) goto(:label:)

would become

ifNotAt(x, y) goto(:label:)

AUTO COMPLETE OPERATOR
Sometimes you want your script to perform an action, and wait until that action is completed before moving on. Use the autocomplete operators for this.

. <- Adding a '.' period to the end of your command will cause the command to execute ONCE, and wait until completion before continuing.
.. <- Adding a '..' double period to the end of your command will cause the command the keep on executing until completion.

Without the auto-complete operator
:WALKTOBANK:
walkTo(x, y)
wait(1000,2000)
ifNotAt(x, y) goto(:WALKTOBANK:)
goto(:label:)

would become

With the auto-complete operator
:WALKTOBANK:
walkTo(x, y). <- notice the auto complete operator here. This would click just ONCE, and wait until your player reaches x, y
goto(:label:)

openDoor(x, y).. <- notice the auto complete operator here. This would keep on clicking until your player reaches x, y
goto(:label:)

COMMAND ARGUMENTS
You have the choice of using either ID's or full names as the command arguments. Either of these two statements are equivalent:

useOnInvItem(logs, knife)
useOnInvItem(13, 14)

VARIABLES
There are 10 variables you can use in your scripts to store user input: $var0-$var9.
Variables must be written with a dollar sign "$" in front of their name. Here is an example:

getInput($var1, "What type of NPC would you like to attack?")
attack($var1)

OR

getOption($var2, "Please select the type of rock to mine", "Iron", "Coal")
ifVarEqual(0, $var2) goto(:MINEIRON:)
ifVarEqual(1, $var2) goto(:MINECOAL:)

HAPPY SCRIPTING!

zunder
New user

Posts : 48
Join date : 2011-04-06

Back to top Go down

Re: Tutorial for Anyone :) Even if your 12 and can read..

Post by password on Tue Apr 12, 2011 12:49 pm

why are u reposting this stuff thats already here stickied and also comes with the bot? seems u just copy and pasted the txt files.

password
New user

Posts : 220
Join date : 2011-01-19

Back to top Go down

Re: Tutorial for Anyone :) Even if your 12 and can read..

Post by Lattes on Mon Apr 18, 2011 8:51 pm

jRah wrote:New addition are highlited in GREEN

COMMENTS
; This is a comment
Anything with a semicolon in front of it gets ignored when the script runs.

WHITESPACE
Added whitespace along the same line has no effect on the script.  For example, these commands are all the same:

goto(:label:)
goto  (:label:)
goto(  :label:  ) ;This is a comment
ifAt(  x , y)
ifAt (x,y)

STRINGS AND STRING CONCATENATION
Strings
Any strings must have quotation marks around them.  Names of items, objects, and NPC's are not considered strings, and will cause an error if delimited by quotation marks.  Here are some examples:

print(Hi there!)   <- This would cause an error
print("Hi there!") <- The correct way
attack("man")  <- wrong way
attack(man)    <- right way

Concatenation
The addition "+" charcter is the string concatenation operator.  Here is an example:

print("hello " + "there!")   output: Hello there!
print("Nice to meet you " + $var4)  output: Nice to meet you [value of $var4]

LABELS
Labels look like this:

:label:

use them with goto(:label:) commands to control the flow of your script.

IF...COMMANDS
IF... commands can be followed by any other SINGLE command, so long as it's not another if....command

ifAt(x, y) goto(:label:) <-CORRECT
ifAt(x, y) say("I've Arrived!") <-CORRECT
ifAt(x, y) say("I've Arrived!") goto(:label:) <-WRONG

if... commands must be on the same line. Use them to control the flow of your script.


LOGICAL NOT OPERATOR
Simply placing the word "not" in any of your script commands reverses its logic.  Here is an example:

ifAt(x, y) goto(:label:)

would become

ifNotAt(x, y) goto(:label:)

AUTO COMPLETE OPERATOR
Sometimes you want your script to perform an action, and wait until that action is completed before moving on. Use the autocomplete operators for this.

. <- Added a '.' period to the end of your command will cause the command to execute ONCE, and wait until completion before continuing.
.. <- Added a '..' double period to the end of your command will cause the command the keep on executing until completion.


Without the auto-complete operator
:WALKTOBANK:
walkTo(x, y)
wait(1000,2000)
ifNotAt(x, y) goto(:WALKTOBANK:)
goto(:label:)

would become

With the auto-complete operator
:WALKTOBANK:
walkTo(x, y). <- notice the auto complete operator here. This would click just ONCE, and wait until your player reaches x, y
goto(:label:)

openDoor(x, y).. <- notice the auto complete operator here. This would keep on clicking until your player reaches x, y
goto(:label:)


COMMAND ARGUMENTS
You have the choice of using either ID's or full names as the command arguments.  Either of these two statements are equivalent:

useOnInvItem(logs, knife)
useOnInvItem(13, 14)

VARIABLES
There are 10 variables you can use in your scripts to store user input: $var0-$var9.
Variables must be written with a dollar sign "$" in front of their name.  Here is an example:

getInput($var1, "What type of NPC would you like to attack?")
attack($var1)

OR

getOption($var2, "Please select the type of rock to mine", "Iron", "Coal")
ifVarEqual(0, $var2) goto(:MINEIRON:)
ifVarEqual(1, $var2) goto(:MINECOAL:)

HAPPY SCRIPTING!

Lattes
New user

Posts : 73
Join date : 2011-04-10

Back to top Go down

Re: Tutorial for Anyone :) Even if your 12 and can read..

Post by password on Tue Apr 19, 2011 12:28 pm

... the point of quoting only? thats so retarded.

password
New user

Posts : 220
Join date : 2011-01-19

Back to top Go down

Re: Tutorial for Anyone :) Even if your 12 and can read..

Post by Lattes on Tue Apr 19, 2011 1:15 pm

^To show that it's the exact same?

Lattes
New user

Posts : 73
Join date : 2011-04-10

Back to top Go down

Re: Tutorial for Anyone :) Even if your 12 and can read..

Post by wtf on Sat Sep 10, 2011 4:45 am

It's true. I was 12 when I started to script. Learning java now Very Happy

wtf
New user

Posts : 86
Join date : 2010-12-08
Location : in ur pants :D

Back to top Go down

Re: Tutorial for Anyone :) Even if your 12 and can read..

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum