xeloader Creator & Owner
Number of posts : 326 Age : 31 Programming Skill : Programming Languages : VB.net, Java [A little], HTML. Registration date : 2008-07-08
| Subject: [503+] Commands Tutorial~ Tue Dec 30, 2008 11:19 pm | |
| Hello everyone! Got some requests and questions about commands... So to help you all out, here's a "lesson" and "spoonfeeding" at the same time XD Requirements: - Notepad, or another texteditor. - A Runescape 503+ server! For example, XeloXoft. - A brain xD Let's start!1. Player Rights- Open up Commands.java, in " [508] XeloXoft> Server > Src > Palidino76 > rs2 > io > packets > Commands.java" - You will find something like this if you scroll down: if (p.rights >= 0) { /**User Commands**/ |
- Let's start with this part, p.rights >= 0. That little bit of code, makes so all the lines of code inside the "brackets" (You will get it in the next chapter) can be used by ordinairy accounts and higher. Here's a table just to show you.p.rights >= 0 = Ordinairy accounts and higher accounts. p.rights == 0 = Only ordinairy accounts. p.rights <= 1 = Moderator accounts and lower accounts.
Ints: Admin = 2 Moderator = 1 Normal = 0
| NOTE: Of course you can change the numbers to other rights, this was just to show you. If you didn't understand the table, just check the bolded symbols again. You will get it after a couple of minutes.2. BracketsThe brackets -> " {" and " }" are really important in Java programming, in C++ and C# too. But this is java... This is kinda tricky to explain but i will do my best! The brackets are the "fence", ye fence You will think like "WTF", and of course this is really tricky. But when you get it, you are a footstep closer to program in java! Let's say, i have a bit of code here: if (p.rights == 0) { titles = "<img=3>"; colors = "<col=6374B5>"; } |
- You see the brackets? Good... You see, it's like surrounding the code? It's "making" the code. Like a fence, without the fence your sheeps will run away. It's the same with the code, without the brackets your code will "run" away and be compiled at another place. (Did i really come up with that myself? I'm a poet xD haha..) Wich will lead to alot of errors (in most of the cases). For example:if (p.rights == 0) titles = "<img=3>"; colors = "<col=6374B5>";
|
- Now it's without the brackets and the code will "run away" to the next bit of code. (i know it won't happen anything with this bit of code, but still. I'm just here to help! ) So as I said in the "Player Rights" chapter. The p.rights == 0) { does have two brackets, and both of them are "connected" to each other sorrounding the code. A great way to save alot of space in your command file. Read this many times, and if you still don't understand. Send me a pm or a mail, OR talk to me on msn. 3. The commandI think you are kinda bored of reading all this.. And are very excited to make a command? Right? So, there are alot of different commands, ::pure (Gives you pure stuff, ::tele (Teleports you), ::master (all skills 99) and ::pickup (Gives you the item you type in). That's the most common commands. But, if a server doesn't have those commands? You need to make them yourself, right? I'm going to teach you some of the code inside them. - Now when you are in your commands.java file, and you know what brackets are, and what they do? Good, and you know where to put your commands if you want it to be used by admins only, or moderaotrs and lower and so on.. Here's an example of what a command could look like: else if (cmd[0].equals("godwars")) { p.teleportTo(2881, 5310, 2, 4, 0, 8939, 8941, 1576, 0, 1577, 0); p.frames.showInterface(p, 255); p.frames.setString(p, "Welcome to the Godwars! During the third age, the gods fought one final war over the possesion of a sword... A mighty sword, they call it a godsword. Now it's your turn to change the history, get your hands on a godsword and be the greatest warrior of them all!", 255, 3); p.frames.sendMessage(p, "Type ::gods for more information about the gods!"); } |
- This command, ::godwars will tele you to the godwars dungeon and send you a interface with a "string" (text) on and send you a message in the Chatbox. Here's a table to split up the code, and tell you what they all do. else if (cmd[0].equals("godwars")) | This is your text to type, when you are ingame. like this one is ::godwars, but if you change "godwars" into "xeloader" and you type ::xeloader ingame, you will be teleported into godwars dungeon. So the text is the command The rest isn't that important for now! | p.teleportTo(2881, 5310, 2, 4, 0, 8939, 8941, 1576, 0, 1577, 0); | 2881 is the X coord, 5310 is Y coord and 2 is the heightlevel. The rest of them are Teleport variables, timers, gfx and animations, so don't touch them if you don't know what you are doing. | p.frames.showInterface(p, 255); p.frames.setString(p, "Welcome to the Godwars! During the third age, the gods fought one final war over the possesion of a sword... A mighty sword, they call it a godsword. Now it's your turn to change the history, get your hands on a godsword and be the greatest warrior of them all!", 255, 3); | This is the Interface that pops up when you use the ::godwars command. 225 is the interface ID, p.frames is the "path" to the frames. It's not so much to tell you about this, it's easier to learn yourself. | p.frames.sendMessage(p, "Type ::gods for more information about the gods!"); | This sends you the message in the Chatbox, Change the text inside the "" to change the text that's getting sent. | AND | |
| |
|
Masterchef Moderator
Number of posts : 61 Programming Skill : Registration date : 2008-12-18
| Subject: Re: [503+] Commands Tutorial~ Sun Jan 11, 2009 12:03 am | |
| Thanks, I needed this for my server . Post the Tutorial for the commands like "::3rdage" "::godswords" in a new topic. And a way to "Compile" because i cannot find the "Compile" file. Thanks //Masterchef | |
|
xeloader Creator & Owner
Number of posts : 326 Age : 31 Programming Skill : Programming Languages : VB.net, Java [A little], HTML. Registration date : 2008-07-08
| Subject: Re: [503+] Commands Tutorial~ Sun Jan 11, 2009 5:43 pm | |
| No problem. I will try to fix it as soon as possible! Just got home from a camp so C ya //Xeloader | |
|
Masterchef Moderator
Number of posts : 61 Programming Skill : Registration date : 2008-12-18
| Subject: Re: [503+] Commands Tutorial~ Sun Jan 11, 2009 5:57 pm | |
| alright thanks //chef | |
|
Sponsored content
| Subject: Re: [503+] Commands Tutorial~ | |
| |
|