Live Help
Membership
You are a guest!

Register Today!

Log In
Reset Password
Game Network
Community Forum

MMO GAME LIST
World of Warcraft
Age of Conan
Anarchy Online
Archlord
Cabal Online
City of Heroes
City of Villains
Dark Age of Camelot
Darkfall Online
Diablo 2
Dungeons and Dragons
Dofus
Eve Online
Everquest 2
Final Fantasy XI
Guild Wars
Hero Online
Knight Online
Lineage 2
Lord of the Rings Online
Maple Story
Ragnarok Online
Runescape 2
Second Life
SilkRoad Online
Star Wars Galaxies
Tibia
Warhammer Online

FPS GAME LIST
Call of Duty
Combat Arms
Counter Strike
Halo

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Java Scripting part 1.
post Mar 11 2009, 02:22 AM
Post #1

mistikman



Egotistical Sociopathic Perfectionist
Group Icon

Group: Moderator
Posts: 1,398
Joined: 2-July 07
From: Never never land.
Member No.: 353,738






xXx-=MistiKmaN's guide to Java basics=-xXx


Intro


Today I will be teaching you the very, very, very, very basics of Java Scripting. I am writing this because it will help you with RSBot and this also helps me to learn. When I am done learning omething, I write up a guide and it helps me. You will be learning about commonly known things called Variables. There are 3 main kinds of variables, named: Integer, String and Boolean. I will also be showing you how to use them. Variables are used in all forms of programming and once you have learnt these, everything else isn't so hard, so let's get started then, shall we? No? Oh ok then... Just kidding. grin.gif I will be using this in conjunction with RSBot as I assume that is what most people here would like to use it with, as do I.


Integers


If you're in year 10 (Australia) you may have heard about these in your maths class. Integers are just numbers. BUT. They are whole numbers. Meaning they mustn't have decimal points or fractions etc. Yes, they can be negative. You would use an Integer for such things as, the amount of ore you've mined, skill levels, amount of items in your inventory and things such as that. smile.gif
Onviously, as you would know from my other guides(In sig.) you have to declare things like this. To declare an Integer you would have to type in this;
CODE
int IntegerName = 69;

The code explained:
int This is the name of the variable you're using, in this case an Integer, which as you can plainly see is abbreviated to "int"

IntegerName I trust you are all smart enough to know that this is the name of the Integer, which is what you use to call upon it later in script designing.(Don't worry if you didn't understand that, it will be explain in another guide.) Another thing, which would be very helpful, would be to say that it IS case sensitive.

= This is just telling the computer that the integer is going to equal whatever follows the equal sign. grin.gif

69; 69 Is what the Integer equals, and the semi-colan(;) is telling the computer to go to the next line of the script. Now how easy was that!? smile.gif
Moving on.

Strings

You NEED these! In RSBot, you'll need these for things like Auto-Talkers, Auto-Logins and such. Strings can contain letters, numbers, even symbols! To setup a String one would input the following:
CODE
String StringName = "1MistiKmaN1";


If you followed the Integers quite easily you should get this quite simply, it's exactly the same, just with different words.

String This is declaring the type of Variable to be used. In this case, a String. :D

StringName Self explanatory, this is what you decide to name your String. Once again, you would use this to call upon it later in the script design. ;)

= Telling the computer, once again, that the String is going to equal(Be.) whatever follows.

"1MistiKmaN1"; And this would be the actual String. The String MUST be contained within quotation marks(" ") and the semi-colon(;, in case you forgot what that is.) telling the computer it is the end of the line.
Moving on again.

Booleans


Booleans are True or False statements. They return whether you are in a random, your hitpoints are at a certain level, you are fighting the correct monster and things like that. declaring the Booleans is the same as other Variables:
CODE
boolean InRandom = false;


Eh, same as before...

boolean Type of Variable.

InRandom Name of the Boolean. Once again, this is what you'd use to call upon it.

= Boolean will equal what follows.

false; Saying that the Boolean is false and you are in fact(If the name is used correctly) not in a random. Semi-Colon saying that it's the end of the line.

Using Variables


This part could take a little time to understand, but before you flood me with questions, read it a few times and read it in full.
CODE
int HpLevel = 50;
int NextHpLevel = HpLevel + 1;


Before I explain anything further, you must learn how to use Addition, Subtraction, Multiplication and Division in your script.
Addition symbol = +
Subtraction Symbol = -
Multiplication Symbol = *
Division Symbol = /
The Division Symbol must be a forward slash.

Now you know what the first line of the code above was, but let me explain the next line. Well, what I would assume you wouldn't know.

HpLevel + 1; The "HpLevel", you just called upon an Integer! It used your stored Integer and added 1 onto it to tell you what your next HitPoints level would equal! WooHoo!
Now for using Strings. -.-
CODE
String Username = "mistikman";
String Pass = "ummno";
String ScammerQuestion = "What's your password?";
String SnappyResponse = "My pass is " + Pass;


And you just did exactly the same as before but with Strings! :D

Now, using Booleans. Should be simple enough. wink.gif
CODE
boolean attackMonster = true;
boolean weCanAttack = attackMonster;
boolean doSpecial = false;


Methods


Methods are what we make the computer do. :D That's a little less work for us. xD To use a method, you must first write it up, and then tell the computer when to use it. This is something we will be using a bit later:
CODE
int HP = getMyHitpoints();


Thankfully, SpelJohan has provided us with some "functions" that will gather values for us, which is what we did just now. By typing in getMyHitpoints() it called upon a function that returns and stores your hitpoints into the integer entitled "HP".
Now on your way to writing up your first method:
CODE
public void HeyNoob();{
}


public Do not worry about this, you will not need it.

void This is where a Variable should be. All method's must return a type of Variable, but if you put this in there, you're telling the computer you do not want a Variable returned.

HeyNoob();{ HeyNoob() is the name. Yes, you must have the parenthesis(()) there. ; Next line. And the bracket ({) is symbolising the start of the method.

} This bracket, as you should be able to figure out, is telling the computer to stop the method. smile.gif

If you ran that, it would do nothing. Let's try adding the basic's basic code, eh?
CODE
log("Hey, what's up?")


log Is a function that tells the computer you want whatever's inside the brackets and quotation marks to be brought in the RSBot thingy down bottom.

("Hey, what's up?") This is called an argument, it will be put into the RSBot chat thingy, I can't remember what it's called, but yeah... What you want said must be within quotation marks.

Arguments in Methods


CODE
public void HeyName(String UserName){
  log("Hello");
  log("My username is " + UserName);
}


Now if you're down this far, you should be able to understand it. You should also know that this method will not do anything without this:
CODE
String UserName = "MistiKmaN";
HeyName(UserName);


If you added that it would come out like this:
"Hello
My username is MistiKmaN"


Aiight, now for "Returning" things.
CODE
public int getMyHP(){
  return (How to get HP here);
}


As you can see, instead of void, it now contains int. This is because you want the value to be returned as an Integer. smile.gif The returned value would be stored in the Variable "getMyHP()". return is the function to be used to get the HP and whatevers in the brackets, is the method used to actually get your HP. Understand? Good.
Now you must use this. :D Use this code instead, in order to use it:
CODE
public int getMyHP(){
  return (How to get HP here);
int myHp = getMyHP();
log("Hp level is " + myHp)
}

And here's the explanation:

int myHp = getMyHP(); This is like telling the computer, "Hey, I want the Integer "myHP" to equal whatever the function "getMyHP()" returned.

log("Hp level is " + myHp) Now you're telling the computer to write into the RSBot box thingy down bottom, "Hp level is 50" See? How easy was all that.

Outro

Now how easy was all that? If you didn't get it, go and clear your heads of any thought and then come back and read again until you do understand it. smile.gif And if you did understand it, congratulations, read it again tommorrow, just to make sure you got it right! Now, I'm working on a part 2 of this guide, so look forward to it! Another great guide by MistiKmaN! Ciao.


--------------------
SIGNATURE!

Go to the top of the page
 
+Quote Post
post Mar 11 2009, 02:22 AM
Post #

Elite Membership


To get the most out of MmorpGuides.com, please view the following information.












Already a Member?

With an Elite Membership you can. . .

  • Reach the highest levels in no time
  • Have one of the most powerful characters in your game
  • Become a valuable member of your clan or guild
  • Become part of a caring and helpful community of gamers

Elite Members enjoy. . .

  • 1,660+ Cheats - tons of working, high quality cheats
  • 1,550+ Guides - We have one of the most comprehensive collections of guides on the net
  • 539+ Bots and macros - Level up quickly, even while you sleep!
  • A chance to win free prizes such as an amazing Playstation 3! And free gold and powerleveling!

No risk, only huge benefits!

  • Your investment can pay for itself in days!
  • Earn gold that you can trade for real money
  • Sell your high level items and characters for a profit!
  • Get tons of expensive guides and cheats in one spot for one small price

Money Back Guarantee!

Not 100% satisfied? We have a 24 hour, money-back guarantee! Contact us for a prompt and courteous refund!

Upgrade to an Elite Membership now!

Not A Member?

Join today and get access to all these great features!

  • Access to newly submitted cheats and guides
  • Download newly submitted bots and macros
  • Chat about your favorite game
  • Submit working content for a FREE Elite Membership!
  • And lots more!
Register Today!
Go to the top of the page
 
Quote Post
post Mar 12 2009, 09:25 PM
Post #2

tobygreener



Master
Group Icon

Group: Elite Members
Posts: 321
Joined: 10-January 09
From: England
Member No.: 812,494






hehe the guide look good i under stood it very well i knew most of them anyways i just can't figer how to put them to gather but really all i need to do is read a few script :P

and nice guide

if i gave you a script could you edit it and add a auto login/


--------------------
Title:The Evil Redhead Chipmonk By Qwinta
Go to the top of the page
 
+Quote Post
post Mar 13 2009, 02:06 AM
Post #3

mistikman



Egotistical Sociopathic Perfectionist
Group Icon

Group: Moderator
Posts: 1,398
Joined: 2-July 07
From: Never never land.
Member No.: 353,738






I'm still trying to tackle that myself, but yes, I'll try.

And thanks for the nice comment. smile.gif


--------------------
SIGNATURE!

Go to the top of the page
 
+Quote Post
post Apr 16 2009, 11:55 AM
Post #4

guitarguy1244



In Training
**

Group: Members
Posts: 9
Joined: 16-April 09
Member No.: 885,914






Thanks man, im currently trying to figure out how to make a chest thiever (the ones in ardrougne or however you spell it) im still a little bit confused, but maybe you could help me out...

This is prbobably one of the most newbiest questions your gonna be asked, but ive never coded or scripted or anything..... where do i download the program to be able to write a "java script"?

and also, how would someone be able to set it up to randomize the time, and to click on "check for traps"?

Please help, thanks man
Go to the top of the page
 
+Quote Post
post Apr 19 2009, 11:18 AM
Post #5

mistikman



Egotistical Sociopathic Perfectionist
Group Icon

Group: Moderator
Posts: 1,398
Joined: 2-July 07
From: Never never land.
Member No.: 353,738






Aiight man, I'm not a pro, I'll tell you that much.
You can create a JavaScript in Notepad.
That's what I use, although it's not so good lol.
Um, I can't remember what the program's called, but you can download it and configure it for RSBot and it'll have a list of all the funcitons. I'll get the name soon and edit this post. wink.gif
As for randomising things, I'm sure you just do somehting like this: code]wait(500,1000,7,7)[/code]
"Wait" A Function that makes the computer wait a little bit untin continuing the script.
"500,1000" This is how long to wait for. 500 Being the minimum time it'd wait for, and 1000 being the maximum.
"7,7" And this would be what you're looking for, the random part. smile.gif The first 7 adds or subtracts a radnom amount, up to a max of 7, to the minimum wait of 500. And the second 7 does the same but for the maximum. smile.gif
Hope I helped. :D


--------------------
SIGNATURE!

Go to the top of the page
 
+Quote Post
post Jul 2 2009, 05:25 PM
Post #6

Astronam



In Training
**

Group: Members
Posts: 42
Joined: 20-August 08
Member No.: 717,668






ive practiced i bit of c++ and the functions are basically the same, but you have to call (import) different libraries of of functions. I use the dev c++ compiler if thats anyhelp. its like microsoft word and makes suggestions to whats suppose to be in your script. i don't know if it can do java, but i guess u got nothing to lose for trying.


--------------------
What do i need a signature??? people can tell who i am. It's hard to forget a person this good looking.

No it isn't, people forget about me all the time.
Rofl, from MistiKmaN.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 


> Board Footer
Time is now: 17th March 2010 - 10:21 PM