Jump to content

Search the Community

Showing results for tags 'java'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 251 results

  1. looking for a java programmer interested in giving extra help in launching my sever (unpaid) but probably after the launch will be hired as official programmer call me discord if you have interest in help and to be a bigger with us ! HijaZi#6717
  2. Java Daily - Home Hey all, I started this project around May of 2014 as something small, but after working on it, I found that it could have some huge potential. My influence revolved around sites like Khanacademy, CodingBat, and other programming-learning experience type websites. Currently, Java Daily contains a set of 6 exercises ranging from easy to hard. Users can read, code, compile, and run their code directly in their browser for ease of use. Edit (October, 2016): I've just brought this thread back from the dead, so please be patient while I add more information. Questions/Prompts: Select an exercise on the left, read the prompt to the top, then fill in your answer to be checked against the system. Logger and Compiler Errors: Java Daily will always give you feedback in relation to wrong answers or in the event of a runtime/compiletime error.
  3. Hey all, ran into a connection pooling library called c3p0 and it's really proven itself to be promising. I went over some documentation and articles on it and wanted to provide RL with a basic class already setup so users can either use/fool around with it. For those who don't know what connection pooling is, you can just [URL="https://www.google.com/search?q=what+is+connection+pooling&ie=utf-8&oe=utf-8"]google it[/URL]. It cuts down SQL connection time significantly and I consider it a must have for any application using SQL. For this to work, you need to include the following jars in your project. [URL="http://www.filedropper.com/pooling"]Download Here[/URL] [code] package org.pooling; import java.sql.Connection; import java.sql.Statement; import java.util.Timer; import java.util.TimerTask; import com.mchange.v2.c3p0.ComboPooledDataSource; import com.mysql.jdbc.CommunicationsException; public class PooledSource { private static PooledSource pooledSource; private ComboPooledDataSource cpds; private boolean online; private static final String IP = "127.0.0.1", PORT = "3306", DATABASE ="db_name", USERNAME = "db_username", PASSWORD = "db_password"; private PooledSource() { try { cpds = new ComboPooledDataSource(); cpds.setDriverClass("com.mysql.jdbc.Driver"); cpds.setJdbcUrl("jdbc:mysql://" + IP + ":" + PORT + "/" + DATABASE); cpds.setUser(USERNAME); cpds.setPassword(PASSWORD); cpds.setInitialPoolSize(5); cpds.setAcquireIncrement(10); cpds.setMinPoolSize(10); cpds.setMaxPoolSize(200); cpds.setMaxStatements(200); Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { [MENTION=15855]Over[/MENTION]ride public void run() { updateDatabaseStatus(); } }, 0, 5000); } catch (Exception e) { e.printStackTrace(); } } /** * updateDatabaseStatus() * Updates the status of the database to online/offline */ private void updateDatabaseStatus() { try { Connection connection = getConnection(); Statement stmt = connection.createStatement(); stmt.executeQuery("select 1+1 from DUAL"); stmt.close(); connection.close(); online = true; } catch (CommunicationsException e) { online = false; } catch (Exception e) {} System.out.println("Database is " + (online ? "online" : "offline")); } /** * query(sql) - for non data returning queries * [MENTION=75098]Para[/MENTION]m sql - sql statement to be executed */ public void query(String sql) { if (online) { try { Connection connection = getConnection(); Statement stmt = connection.createStatement(); stmt.executeQuery(sql); stmt.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } /** * getInstance() * [MENTION=184045]return[/MENTION] - instance of our connection pool */ public static PooledSource getInstance() { try { if (pooledSource == null) { pooledSource = new PooledSource(); return pooledSource; } else { return pooledSource; } } catch (Exception e) { e.printStackTrace(); } return null; } /** * getConnection() * [MENTION=184045]return[/MENTION] - a connection from our pool */ public Connection getConnection() { try { return this.cpds.getConnection(); } catch (Exception e) { e.printStackTrace(); } return null; } public boolean isOnline() { return online; } } [/code] Example Use: [code] PooledSource ps = PooledSource.getInstance(); //This only needs to be initialized once. Put it in your server startup or wherever you choose. //called wherever you want Connection connection = ps.getConnection(); Statement smt = connection.createStatement(); ResultSet rs = smt.executeQuery("SELECT * FROM members WHERE bla..."); //do stuff with resultset rs.close(); smt.close(); connection.close(); //make sure all your resources are closed [/code]
  4. I'm back and am having some trouble with commands not working. The command folder is in The source but when I use a command it dosent to anything in game and in my source it says something like this... Java.lang.error: Unresolved compilation problem: Then goes on about 15 lines... I have gone on eclipse and have looked at commands.java->commands->processCommand where it looks like the error is taking place. Public static boolean processCommand(Player player, String command, boolean console, boolean clientCommand) { If (command.length() == 0 // if they used ::(nothing) there is no command return false; Ect ect ect ect... I'm not typing all that out. I think this is the error but if you disagree or can help me comment below. I'm in my first month of Java so please keep it simple. Thanks!
  5. I need to compile or run this code to dump music [CODE]import java.io.*; import java.util.zip.GZIPInputStream; public class MidiDumper { private static final String folder = "C:\\WINDOWS\\.file_store_32\\runescape\\"; private static final String savefolder = "C:\\save\\"; private static DataInputStream cache; public static void main(String args[]) throws Exception { File f = new File(folder + "main_file_cache.dat2"); byte bytes[] = new byte[(int) f.length()]; new FileInputStream(f).read(bytes); BufferedInputStream cache2 = new BufferedInputStream(new ByteArrayInputStream(bytes)); cache = new DataInputStream(cache2); cache.mark(bytes.length); DataInputStream midi = new DataInputStream(new FileInputStream(folder + "main_file_cache.idx11")); int count = 0; while (midi.available() > 0) { int length = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte(); int offset = (midi.readUnsignedByte() << 16) + (midi.readUnsignedByte() << 8) + midi.readUnsignedByte(); byte[] b = readFile(length, offset); if(b == null) continue; File file = new File(savefolder + "midi" + (++count) + ".mid"); if(!file.exists()) if(!file.createNewFile()) continue; RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.write(b); raf.close(); } } public static byte[] getParody(int index) throws Exception { cache.reset(); byte buffer[] = new byte[520]; int jump = index * 520; cache.skipBytes(jump); cache.readFully(buffer); return buffer; } public static byte[] readFile(int size, int offset) throws Exception { byte b[] = getFile(size, offset); int length = ((b[5] & 0xff) << 24) + ((b[6] & 0xff) << 16) + ((b[7] & 0xff) << 8) + b[8]; if(length > 0) { if(b[0] == 2) { GZIPInputStream d = new GZIPInputStream(new ByteArrayInputStream(b, 9, length)); byte z[] = new byte[b.length]; int i = d.read(z); byte x[] = new byte[i]; System.arraycopy(z, 0, x, 0, i); return x; } else if(b[0] == 1) { System.out.println("Fu**in' sh**, it's not a midi!!!"); return null; } return b; } return null; } public static byte[] getFile(int size, int offset) throws Exception { if(offset <= 0) return null; byte outfile[] = new byte[size]; int bits = offset; int length = 0; while(true) { byte buffer[] = getParody(bits); if(buffer == null) return null; bits = ((buffer[4] & 0xff) << 16) + ((buffer[5] & 0xff) << 8) + (buffer[6] & 0xff); if(size - length - 8 > 512) { System.arraycopy(buffer, 8, outfile, length, 512); } else { System.arraycopy(buffer, 8, outfile, length, size - length - 8); return outfile; } length += 512; } } }[/CODE] But i dont know how.
  6. i need to convert rs music to mid http:// [url]www.rune-[/url] server.org/ runescape-development/rs-503-client-server/snippets/394195-midi-encoder.html but i dont know how compile java script.
  7. I was trying to change the dialogue of a npc when no changes happened after compiling. I then tried deleting the .class file and noticed that no new one as created when I ran my compiler. It works for every other .java file I have tried so far and even for files in the same folder. Never experienced this before and havn't found anything that seems relevant when searching. What could cause this and how do I fix it?
  8. What's your preference? I want a video series that yields a strong independent programmer.
  9. So ive been strengthening my programming skills lately by writing tons of programs, i was looking at some forums and i came across a thread that was having a debate on using Static modifiers... Ive come to rely heavily on them in all my programs and im so confused on why they are/are not bad... Ive read up alot on the subject and my searches always end up with people arguing back and forth and no real definitive answer, so ill ask all the java programmers on this site... Whats the deal with them? Should i not use them at all? Should i use them sparingly? Why are they bad? Im so confused on the subject and admittedly a little discouraged because as ive said before i use them heavily and not using them would wreck my entire programming style, but if they are really bad practice obviously i want to learn how and more importantly why to get rid of them. What do you guys think?? [B]TL;DR [/B]Why are statics bad practice(if they are), should they be used? Thanks guys!
  10. Hey all, my friend just messaged me on skype today asking for some help with a homework problem he received. At first I didn't think it would take that long, but it actually made me think critically (mainly about string indexing) in order to finish it, which I feel boosted my knowledge on the subject. Even in other languages, it might serve useful. Here's the question if anyone else feels like putting their brain to the test (I have a solution if anyone wants to message me for it). To help clarify the question below: - A single string is inputted into the system. You must output line widths of exactly 20 characters (from the original string). - All spaces must be replaced by periods '.' - No words may be wrapped to the next line. - A line must NOT start or end with a period. - You may add periods to a line to fill spaces (as seen in output picture below). [IMG]http://i.imgur.com/SglC0Uc.png[/IMG] A string array representation of what my program outputted (1 of many ways to do it): [IMG]http://i.gyazo.com/c6733870b2c0a356ead08670b3722377.png[/IMG]
  11. Hello guys, I would like your recommendations on what encryption algorithm I should use for client<->server communication that is sensitive and where client must be authenticated so that data replay is not possible or harder to do. I was making a keystore that uses RSA but then I got confused about how encryption/decryption happens in the client side if the client side only has the public key.
  12. [CENTER][I][COLOR="#FF0000"]THIS TUTORIAL IS NOT COMPLETE![/COLOR][/I] [I]This is an add-on to the "RuneLocus Java tutorials". Please read [URL="http://www.runelocus.com/forums/showthread.php?34729-The-Basics-of-Java"]The Basics of Java[/URL] posted by [URL="http://www.runelocus.com/forums/member.php?153-Trey"]Trey[/URL] [B]before[/B] you dive into this tutorial.[/I] [SIZE=4][COLOR="#FF8C00"]Syllabus:[/COLOR][/SIZE] Introduction Expectations Getting started References [SIZE=4][COLOR="#FF8C00"]Introduction:[/COLOR][/SIZE] Welcome to my tutorial on the basics of 2D graphics production in Java. I am Scott, I commonly go by the name of Jett because I am a MapleStory nerd. I have been programming for many years now, having progressed a lot farther than I had initially thought I ever would in the field. A lot (I dare to say to much) of my time has been spent in RuneScape private server communities since 2006 and after all of this time I am more interested in sharing the knowledge I have collected over the years with these communities rather than keep it all to myself. With that said, hopefully I will be able to provide you with further insight into the Java programming language and what it provides in the way of 2D graphics production. [SIZE=4][COLOR="#FF8C00"]Expectations:[/COLOR][/SIZE] This tutorial, while dumbed down a little, still assumes that you have a basic understanding of the Java programming language as well as the AWT (Abstract Window Toolkit), and the Swing API's provided in the Java API. If you think you need to brush up on some stuff before diving into this tutorial I urge you to reference [URL="http://www.runelocus.com/forums/showthread.php?34729-The-Basics-of-Java"]The Basics of Java[/URL] posted by [URL="http://www.runelocus.com/forums/member.php?153-Trey"]Trey[/URL], or the good 'ol [URL="http://docs.oracle.com/javase/tutorial/java/"]Java™ Tutorials[/URL]. [SIZE=4][COLOR="#FF8C00"]Getting started:[/COLOR][/SIZE] The Java API provides a very robust API for rendering any kind of graphics you can think of. The first thing you are going to want to look at when you are looking into 2D graphics production is [I]java.awt.Graphics2D[/I]. [I]java.awt.Graphics2D[/I] provides all of the methods and utilities you will ever need to render and manipulate 2D graphics on a basic, and even advanced level. Getting to know your API is very crucial so before moving on, please read the Java documentation for the following classes: [URL="http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html"]Graphics.java[/URL] [URL="http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html"]Graphics2D.java[/URL] You will notice right away that you have two discernible groups of methods; the methods that actually draw the graphics, and those that manipulate graphics attributes in order to produce different graphical effects. If you could not discern between the two groups, here are a couple basic examples illustrating the two different kinds of methods you are looking at: [spoiler=Examples] [URL="http://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html#drawRect-int-int-int-int-"]drawRect(int, int, int, int)[/URL] [IMG]http://i.imgur.com/XgFUtfD.png[/IMG] [URL="http://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html#fillRect-int-int-int-int-"]fillRect(int, int, int, int)[/URL] [IMG]http://i.imgur.com/TDSOIqR.png[/IMG] [URL="http://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html#drawString-java.lang.String-int-int-"]drawString(java.lang.String, int, int)[/URL] [IMG]http://i.imgur.com/y3KmzgD.png[/IMG] [URL="http://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html#setColor-java.awt.Color-"]setColor(Color)[/URL] [IMG]http://i.imgur.com/jc2fA62.png[/IMG][/spoiler]The methods for actually drawing the shapes, images, and text rely on the applications pixel coordinate grid to position the graphics where you tell them to be, and the methods for manipulating graphics rely on both position and user input in regards to what kinds of manipulation need to happen (for example: color, gradient, font type, etc ...). Here is an application I wrote that uses color, text, and basic shapes to help you get a feel for both the coordinate grid and the basics of producing your own graphics: (Click the picture to view the source code -- Java 8 is required to run this application!) [URL="http://pastebin.ubuntu.com/8368689/"][IMG]http://i.imgur.com/gN10qfA.png[/IMG][/URL] [COLOR="#FF8C00"][SIZE=4]To be continued...[/SIZE][/COLOR] I will be adding onto and revising every section of this tutorial over time. Please tell me if there are areas that I could be more clear, or just didn't elaborate enough on. Thank you for your continued support! [COLOR="#FF8C00"][SIZE=4]References:[/SIZE][/COLOR] [URL="http://docs.oracle.com/javase/tutorial/2d/basic2d/"]Getting Started with Graphics[/URL] [URL="http://docs.oracle.com/javase/tutorial/2d/geometry/index.html"]Working with Geometry[/URL][/CENTER]
  13. Hi i have already googled and spent 2 hours editing and switching my rsps files and i still haven't found a fix for these 3 errors. Code Compiling :D Picked up _JAVA_OPTIONS: -Xmx512M src\Class2.java:14: error: cannot find symbol return JSObject.getWindow(applet).call(string, objects); ^ symbol: method getWindow(Applet) location: class JSObject src\Class2.java:21: error: cannot find symbol return JSObject.getWindow(applet).call(string, null); ^ symbol: method getWindow(Applet) location: class JSObject src\Class2.java:25: error: cannot find symbol JSObject.getWindow(applet).eval(string); ^ symbol: method getWindow(Applet) location: class JSObject Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors Picked up _JAVA_OPTIONS: -Xmx512M src\Class2.java:14: error: cannot find symbol return JSObject.getWindow(applet).call(string, objects); ^ symbol: method getWindow(Applet) location: class JSObject src\Class2.java:21: error: cannot find symbol return JSObject.getWindow(applet).call(string, null); ^ symbol: method getWindow(Applet) location: class JSObject src\Class2.java:25: error: cannot find symbol JSObject.getWindow(applet).eval(string); ^ symbol: method getWindow(Applet) location: class JSObject Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors Press any key to continue . . .
  14. Hash

    Java

    Hello, I'm making this thread to get suggestion from you, members of RuneLocus. I started learning Java and know the basics, I have the patience and passion to learn this programming language, but books bores me and most ways to learn are books or written online books. That's why I'm asking: 'How did you learn Java to get where you are?' Don't say I'm lazy, I know it and that's why I need useful and not boring ways to learn it.
  15. Everytime I compile my client I get this!: The system cannot find the path specified. javac: file not found: *.java Usage: javac <options> <source files> use -help for a list of possible options Press any key to continue . . . --- Can someone please help me!?!?!?
  16. Im working on a game and everything was going as according to plan until i started handling the user input and for some reason it isnt being picked up even know i added a KeyAdapter to the jpanel. Does anyone have an idea what i did wrong. Here's the engine for the game with the keyadapter [code]/** * * @author ethan */ public class Engine extends JPanel implements ActionListener { public enum Selection { MAIN_MENU, CHARACTER_SELECTION, OPPONENT_SELECTION, ITEM_STORE, PAUSE, GAME, ONLINE_MATCH; } private Selection selection; private NPC npc; private NPC npc1; private Player player; public Engine() { selection = Selection.GAME; npc = new NPC(508, 108); npc1 = new NPC(241, 300); player = new Player(); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { switch (selection) { case MAIN_MENU: break; case CHARACTER_SELECTION: break; case OPPONENT_SELECTION: break; case ITEM_STORE: break; case PAUSE: break; case GAME: System.out.println(event.getX() + " " + event.getY()); break; case ONLINE_MATCH: break; } } }); addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { } @Override public void keyReleased(KeyEvent event) { } }); Timer timer = new Timer(5, this); timer.start(); } public void drawFrame() { JFrame frame = new JFrame("Fun Fighter"); frame.setSize(805, 620); frame.setResizable(false); frame.setDefaultCloseOperation(3); frame.add(this); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent actionEvent) { switch (selection) { case MAIN_MENU: break; case CHARACTER_SELECTION: break; case OPPONENT_SELECTION: break; case ITEM_STORE: break; case PAUSE: break; case GAME: player.move(); break; case ONLINE_MATCH: break; } repaint(); } @Override public void paint(Graphics graphics) { Graphics2D g2d = (Graphics2D) graphics; switch (selection) { case MAIN_MENU: break; case CHARACTER_SELECTION: break; case OPPONENT_SELECTION: break; case ITEM_STORE: break; case PAUSE: break; case GAME: g2d.drawImage(new ImageIcon("cache/background.png").getImage(), 0, 0, this); npc.draw(g2d); npc1.draw(g2d); player.draw(g2d); break; case ONLINE_MATCH: break; } } }[/code]
  17. xilit

    Java jre confusion!

    I had "A java exception occurred error" and so I changed my run.bat file to this.... @echo off "C:\Program Files\Java\jre7\bin\java.exe" -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:+CreateMinidumpOnCrash -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -cp bin;./clientlibs.jar; Loader "C:\Program Files\Java\jre8\bin\java.exe" -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:+CreateMinidumpOnCrash -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -cp bin;./clientlibs.jar; Loader "C:\Program Files (x64)\Java\jre7\bin\java.exe" -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:+CreateMinidumpOnCrash -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -cp bin;./clientlibs.jar; [email protected] off "C:\Program Files (x64)\Java\jre8\bin\java.exe" -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:+CreateMinidumpOnCrash -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -cp bin;./clientlibs.jar; Loader "C:\Program Files (x86)\Java\jre7\bin\java.exe" -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:+CreateMinidumpOnCrash -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -cp bin;./clientlibs.jar; Loader "C:\Program Files (x86)\Java\jre8\bin\java.exe" -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:+CreateMinidumpOnCrash -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -cp bin;./clientlibs.jar; Loader pause I tried to squeeze in just about everything I can think of, besides 32 bit op system. So that people don't get the error. Now..... they can open the client using jre8 without the error, but not jre7, why is this even though I have jre7 in this run.bat? Also when my friend did download jre8 it finally opened but the client screen went white.... I am trying to make the client open like every other rsps you see out there. Nice and easy don't have to have nothing but java. Which is what I see myself doing. I am still learning, but I am a quick learner, so any help is greatly appreciated! Also on my laptop + desktop have java jre8 and open and run the server just fine. It's just any computer not in my home.... Client if you need to see - [url]https://www.dropbox.com/s/9pnvz01d4xld2hp/Click%20Client.jar[/url] Skype: cjbeforlife
  18. yo guys As some know, i recently made my server. i started sending it to my friends from skype. but the problem is that there are some people that actually get on and play, and some that get an error "Java exception occured" Anyone know how to fix it? i'd be really glad if anyone helped. ;] thanks.
  19. Hey, when I run my client.jar on my laptop, it opens just fine. But when I try to open it on the desktop, or any other computer, such as my friends, we get "A java exception has occurred." error. I tried turning down the java security etc. but it did not work, and my friend is having the same issue. Why would it work on my laptop, but not elsewhere? Can anyone help me with this? I am using the JarMaker and my manifest is set to "Loader" I could not get the client to open on my laptop without setting it to "Loader". I also noticed that the only way I could get it to open was by selecting the bin folder as the destination it pulls from, because when I click the client as a whole it won't open once done, do I need to select something other than the bin folder when jaring? Also, what is the error "A java exception has occurred", what exactly is it trying to say? Thank you!
  20. Ok, I have this error: [url]http://gyazo.com/232f57490c6a36ddd73bb06c9b3ee1a3[/url] I'm aware I'm supposed to add the port, is that the mysql port. And when I add it to the end of the string it compiles an error. Here is the code: [CODE]public static VoteChecker voteChecker = new VoteChecker("http://rune-project.info", "runeproj_runetoplistv2", "runeproj_vote", "********");[/CODE] Thanks in advance.
  21. Heroeswar

    Need java Coder!

    Hello Runelocus, I need a java coder please pm or reply here or add me on skype Owner_death1 Thanks for helping
  22. So just about finished my first java program ever, and i basically made a virtual dicer based off of RS's 60x2 game using Eclipse, i just want some criticism on how its written, what could i have done better? Are there easier/cleaner ways of doing what i have done? etc etc. i am really really new to java. insight welcome! [COLOR="#FF0000"]YOU CAN C&P THIS TO ECLIPSE TO SEE HOW IT RUNS[/COLOR] Picture of a session: [IMG]http://i60.tinypic.com/2ykdxte.png[/IMG] [code]package Data; import java.util.Random; import java.util.Scanner; public class Dicing { public static Scanner scan; public static Random rand; public static int Money, bet, roll, cash, betConfirm, betorquit,betorquit2,betorquit3,betorquit4, reroll, reroll2; public static void main(String args[]){ scan = new Scanner(System.in); rand = new Random(); Money = 1000; System.out.println(" || You have been given "+Money+" Dollars to start. ||"); System.out.println(" || Press B to place a Bet || Press E to Exit ||"); String playerBetorExit; playerBetorExit = scan.nextLine(); if(playerBetorExit.equalsIgnoreCase("b")){ placeBet1(); } if(playerBetorExit.equalsIgnoreCase("e")){ System.out.println(" || Player Quit.. || CASH : "+Money+". ||"); } } public static void placeBet1(){ System.out.println(" || RULES : || If you Roll 60 or lower you will LOSE your bet || If you Roll a 60, you get a Reroll || "); System.out.println(" || If you Roll above 60 you win DOUBLE your bet ||"); System.out.println(" || STARTING CASH : "+Money+" || How much do you want to bet? ||"); bet = scan.nextInt(); if(bet > Money){ System.out.println("You only have "+Money+" Dollars!"); placeBet1(); } else { System.out.println(" || Are you sure you want to bet "+bet+"? || Press 1 for Yes || Press 2 for No ||"); betConfirm = scan.nextInt(); if(betConfirm == 1){ roll(); } if(betConfirm == 2){ placeBet1(); } } } public static void placebet2(){ System.out.println("CASH : "+cash+" || How much do you want to bet?"); bet = scan.nextInt(); if(bet > cash){ System.out.println("You only have "+cash+" Dollars!"); placebet2(); } if(bet <= cash){ System.out.println(" || Are you sure you want to bet "+bet+"? || Press 1 for Yes || Press 2 for No ||"); betConfirm = scan.nextInt(); if(betConfirm == 1){ roll2(); } if(betConfirm == 2){ placeBet1(); } } } public static void roll() { System.out.println("Rolling.."); roll = rand.nextInt(101); System.out.println("Your roll is "+roll+"..."); winLoss(); } public static void roll2(){ System.out.println("Rolling.."); roll = rand.nextInt(101); System.out.println("Your roll is "+roll+"..."); winLoss2(); } public static void winLoss() { if(roll < 60){ // handles losing cash = Money - bet; System.out.println("You have lost your bet."); System.out.println(" || Balance : "+cash+". ||"); System.out.println(" || Press 1 to place a new bet || Press 2 to quit ||"); betorquit = scan.nextInt(); if(betorquit == 1 && cash > 0){ placebet2(); } else { System.out.println(" || You have went bankrupt ||"); endGame(); } if(betorquit == 2){ System.out.println(" || Player Quit.. || Cash : "+cash+". ||"); endGame(); } } if(roll == 60){ // handles tie System.out.println("Tie! || Would you like to ReRoll? || Press 1 to Reroll || Press 2 to place a New Bet and recieve Refund"); reroll = scan.nextInt(); if(reroll == 1){ roll(); } if(reroll == 2){ System.out.println("You have been refunded..."); cash = Money + bet; placebet2(); } } if(roll > 60){ //handles winning cash = Money + bet*2 - bet; System.out.println(" || You won with a "+roll+". || You now have "+cash+" Dollars! ||"); System.out.println(" || Press 1 to place a new bet || Press 2 to quit ||"); betorquit2 = scan.nextInt(); if(betorquit2 == 1 && cash > 0){ placebet2(); } else { System.out.println(" || You have went bankrupt ||"); endGame(); } if(betorquit2 == 2){ System.out.println(" || Player Quit. || Balance : "+cash+". ||"); endGame(); } } } public static void winLoss2(){ if(roll < 60){ // handles losing cash = cash - bet; System.out.println("You have lost your bet."); System.out.println(" || Balance : "+cash+". ||"); System.out.println(" || Press 1 to place a new bet || Press 2 to quit ||"); betorquit3 = scan.nextInt(); if(betorquit3 == 1 && cash > 0){ placebet2(); } else { System.out.println(" || You have went bankrupt ||"); endGame(); } if(betorquit3 == 2){ System.out.println(" || Player Quit. || Balance : "+cash+". ||"); endGame(); } } if(roll == 60){ // handles tie System.out.println("Tie! || Would you like to ReRoll? || Press 1 to Reroll || Press 2 to place a New Bet and recieve Refund"); reroll2 = scan.nextInt(); if(reroll2 == 1){ roll(); } if(reroll2 == 2){ System.out.println("You have been refunded..."); cash = cash + bet; placebet2(); } } if(roll > 60){ //handles winning cash = cash + bet*2 - bet; System.out.println(" || You won with a "+roll+". || You now have "+cash+" Dollars! ||"); System.out.println(" || Press 1 to place a new bet || Press 2 to quit ||"); betorquit4 = scan.nextInt(); if(betorquit4 == 1 && cash > 0){ placebet2(); } else { System.out.println(" || You have went bankrupt ||"); endGame(); } if(betorquit4 == 2){ System.out.println(" || Player Quit. || Balance : "+cash+". ||"); endGame(); } } } public static void endGame(){ System.out.println(" || THANKS FOR PLAYING 60 x 2 ||"); System.out.println(" || DEVLOPED BY : THEO SOUZA ||"); System.out.println(" || 4/10/2014 04:18 ||"); } } [/code] Only thing left i have to do i believe is if the user inputs a int or string that doesnt have anycode attached to it, it will get ignored.
  23. So ive started this project today and tried to use every method ive learned so far to build i program, its a gambling simulator based of RS dice. Keep in mind im a very new coder and its a work in progress but heres what i got so far! Watch in HD 1080p and Fullscreen [url]https://www.youtube.com/watch?v=_AVdhqew_CI[/url]
  24. In java, there are many confusing words that, well, confuse you. You may hear the terms, "class", and "statement", and "method". Well, all of these words are some of the most commonly used terms in java, so you 'd better get used to them. The class A class is a file that you create that can be run and compiled by the compiler. Usually a .java file is called a class, but one java file can contain many classes; but when you do that, things get complicated, so I will not go over this. A good thing that you may recognize is the client class (client.java), they are compiled from .java to .class files, because you cannot read the version of java that your computer runs. The compiler is a wonderful thing. It checks for errors in your java code, and makes java easier to program for you. The method A method is a section of coding within a class that can be called upon with statements and other methods. Sounds confusing? By the end of this tutorial, you will understand. A method is basically a chunk of coding, that you can just put anywhere, and use repetitively by, "calling," it. I will dig deeper into what calling is later in this tutorial. The Statement Ah, the good old statement. A statement is usually a small chunk of code that can be placed within methods and classes. Statements usually call upon other methods to make their job easier. You can use multiple statements that call the same method. This is why java is so great. To do the job of many statements, you only need one method. A statement is usually used as a conditional, or: if this, then do this. Credits to rune server.
  25. Hello, this is a serious and high quality project. We are looking for a committed lead developer that has extensive Runescape Private Server experience. The founder and Co-Founder(Me) both have java knowledge and have dealt with private servers before. We also already 2 semi-experienced developers. However, we are looking for a very experienced RSPS developer who will be able to take on some of the more challenging tasks. I have the java knowledge to code anything in game, but not the Private Server knowledge. You must be very committed for the long-term, as this project will not be released for a couple months, but it will be bug free, built with flawless execution. You will be paid with a percentage of the donations, so it is in your and the other developers hands in how much you make, a better server will produce more revenue so more pay for you. If interested, contact me on skype - "Fs-brian"
×