Question, could possibly lead to content

This is the place to post your own creative works for other to play or give feedback on!
Forum rules
This forum is for posting and collaborating upon third party work. Please do not post request-threads, and avoid posting artwork that is not your own unless it is being used as a reference.

Question, could possibly lead to content

Postby Kagekaton » Mon Mar 18, 2013 3:45 am

Hello all,

Just to let everyone know I am in no way shape or form an artists, though I do fancy myself an author, so I have begun working on a little project...though I'm having some issues.


What i'm working on is really similar to the some of the languages out there so I came to the only place i could think of that's full of coders :D

I keep getting an error when I attempt to open my project:

ERROR: In line 34, "constant" keyword with insufficient parameters.


Anyone have an idea what i could look for to change?


P.S. line 34 is a description...and if you would like to take a peek at what i have just let me know and i'll send it out to you, complete with a link to download the program so you can see exactly what i'm seeing...

EDIT- Ignore that! I found it!

Now then onto some explanation....


Well first off as I said I'm not artist, thus I'm not a lot of help, second, I have no experience with a language, also makes me of no help, though I can write! but who really wants someone sitting there telling them what to write?

So instead of helping someone, I've decided to go out on a limb and see what you all would think of a nice Text-based RPG, still a little touch and go on the plot, so i'll get back to you guys on that one!

And while I will be the main one working on this if you have any ideas for anything (after i get started) please let me know, i love to write, but i'm not immune to writers block and will always love to have something on the table to just code up and plug in :D

I'm expecting my first little demo within a couple days, :D
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Mon Mar 18, 2013 5:09 am

uh.... what language are you using?
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby whodaman » Mon Mar 18, 2013 9:33 am

ERROR: In line 34, "constant" keyword with insufficient parameters.

Sounds like an error I find when I try to encode my work...and by that I mean when I try to compile Java coding. Though this error may belong to all languages...
whodaman
 
Joined: Wed Mar 13, 2013 12:01 am
Location: Somewhere in AZ

Re: Question, could possibly lead to content

Postby whodaman » Mon Mar 18, 2013 9:37 am

On another note, if your are writing script, I suggest you try notepad++, it might not be good if you are new to the language your using, mainly because it can fix issues in your coding, and you might not understand why your way is wrong and their way is right. But hey, if you know what you're doing, go ahead, its great for just about any language under the sun!
whodaman
 
Joined: Wed Mar 13, 2013 12:01 am
Location: Somewhere in AZ

Re: Question, could possibly lead to content

Postby Kagekaton » Mon Mar 18, 2013 10:06 am

I'm not sure what i did but i just wiped the whole section out and rewrote it (a whopping two minutes of work) and it fixed the problem, not sure how...


But as for what i was going to use i went through looking in depth and i'm not 100 percent how i'm going to be able to do much more than your standard "Go here, grab that, bring it here, repeat" kind of thing, while i don't really mind that, i would prefer to have some sort of combat set up, and frankly...i have no clue how to go about doing that, in fact there is a lot that i'm not sure how i'm going to do using my current language...i'm going to assume it is possible and give it one hell of a shot, but i may be looking for something different, not sure yet, still need to pound out a real GUI, that'll take me a minute, then i need to see if i can even really do a combat thing without it taking months of learning on my own...


I'm rambling...i do that...and i AM NEW to all of this, teaching myself (before i become what is considered an old dog), and always looking for some help from somehow who knows what they are doing...and i'm using JACL if anyone has heard of it, i think it's pretty much dead, but there is someone still out there giving me what little advice i can squeeze from him

EDIT- And i said screw it, I have now switched over to Python, I did take a look at Notepad++ but I couldn't really find a way to learn it, not a lot of people out there posting it on youtube (or i fail at searching at 5 AM) so i'm over to python, though i'm not seeing much in the way of making it pretty, anyone have any knowledge to pass on? Pretty sure i can't really do it on Python itself (not sure though) so i imagine i would need another something or other to do it.
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 1:52 am

I don't know why the one person said notepad++ would show you where you made errors since all it did was basic highlight code depending on what the word did.

Anyways i hate to be a bother but i really suggest you switch over to java because i can help you and so can other people around the forums. I've seen quite a few people post that they're learning java or know java. However, you can't just go jumping from every other language just because some blue guy tells you to. So you kinda have to decide if you see any benefit to changing yet again.

For Notepad++, here's what you do. on the menubar their is one that's called language; click it followed by clicking P for python. Go though the list until you find python and then click it. Now notepad should be setup to treat the file as a python file. Another way of doing this is to click "save as" & not "save" and you'll get dailog box asking where to save the file and what name. Well at what name, under it should be a combo box and if you click it, it will have a huge list of file types to save as. click the one that's related to python and the program should now start considering the file a python file while your programming.

Notepad++ is just notepad done right for programmers. For me it highlights keys words in java and shows me how my encapsulation is.


Also, please remember that you should comment the fricking hell out of your code!
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Tue Mar 19, 2013 6:18 am

I've spent the last few hours (meaning of free time, total time of maybe 2 hours) looking at tutorials on using python, doesn't seem too difficult, i am currently about to go look at Java as you suggest blue, i've heard about it everywhere and from what i gather i should be able to use it at a beginner level at least without much difficulty, we shall see i guess...

But throughout the day at work the same thought has been rolling around in my head, Would the people of LoK even care to read their game? Any thoughts?
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 6:44 am

Kagekaton Wrote:But throughout the day at work the same thought has been rolling around in my head, Would the people of LoK even care to read their game? Any thoughts?


huh?

So if you put source code up, and i know about it; i normally try to take crack at reading it. Hell i've once tried to decompile the source code of a game... that didn't end to well. :roll:

as for the comments, there is no reason not to comment your code and all the more reason to comment it. If I have to read your code and i see something like:
Spoiler (click to show/hide):

Code: Select All Code
/// do note, this is designed to look horrid! Who ever puts this in their code gets a Inu slap from me!
public static final void EPISODEIFEJIEFJIJE_METHOD(int f, Graphic fjiej, String EPICstring, Entity monkey, ai Monkey){
   if(f == 4857|| f == 444 && f != 304){
      monkey.setterIA(new ai("MOOOONNNKEYYYY!!!!!!"));
   }
   else {monkey.setterIA(Monkey);}

   fjiej.method3(new Integer(f));
}


I'd be shocked if you could read this the first time though. It was designed to be ugly but the point is that comments can clear up what this method does. (methods are java word for functions. I don't know what Python calls their functions, but i believe it is just functions.) now look at this simple modification i can do that makes what this code does much clearer.

Spoiler (click to show/hide):

Code: Select All Code
/**
 * EPISODEIFEJIEFJIJE_METHOD takes a int & GraphicCO & String & Entity & ai
 * the program will add a AI to the entity by creating a new one if the int was 4857 or 444 and not 304; else it will use the ai you gave the
 * method.
 *
 * for the graphics object, add the integer to it by using method "method3(int f);"
**/
public static final void EPISODEIFEJIEFJIJE_METHOD(int f, GraphicCO fjiej, String EPICstring, Entity monkey, ai Monkey){ // these names are confusing. rename method at later point!
   if(f == 4857|| f == 444 && f != 304){
      monkey.setterIA(new ai("MOOOONNNKEYYYY!!!!!!"));
   }
   else {monkey.setterIA(Monkey);}

   fjiej.method3(new Integer(f));
}

it's still ugly as all hell but you can at least get a idea of what's happening in your code.
As your program gets bigger, this will be come more and more important since you'll likely forget the over arching design of parts of your program.
Basically comments are a one minute fix now to what could be in the future a 1 hour fix for your self and others.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Tue Mar 19, 2013 7:00 am

That is a very valid point, though i meant, would anyone here really be interested in a text-based game :P
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 7:25 am

Kagekaton Wrote:That is a very valid point, though i meant, would anyone here really be interested in a text-based game :P

Make the game and if no one is intrested take it some where else. I'd say a lot of us enjoy(ed) CoC which is purely text. What i hate are texted based games where you have to type out all your actions. There annoying and a lot of the time the command you say to get something to work just doesn't make sense.

Code: Select All Code
use drugs
use drugs
use the fucking drugs
use the drugs
activate drugs
eat drugs
smell drugs.
drink drugs

Why the hell is it drink!!!


EDIT

Here is a example of what some of my code looks like. Do note i was being bad and not commenting :roll:
So i believe some of this code you could reuse so i'll clean it up for you and comment it.

Code: Select All Code
package gui;

import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextArea;
import javax.swing.JButton;

import engine.Run;

public class Frame extends JFrame implements ActionListener{
   
   private JPanel contentPane;
   private JPanel buttonPanel;
   private JPanel chraracterPanel;
   private JPanel entityPanel;
   private JTextArea textArea;
   private JButton attackButton;
   
   
   private String[] names = {"Attack"};
   private JTextArea playerTextArea;
   
   /**
    * Launch the application.
    */
   
   /**
    * Create the frame.
    */
   public Frame() {
      setTitle("NC 0.02 build 3");
      
      System.out.println("FRAMING OF PROGRAM STARTED!");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 596, 234);
      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      contentPane.setLayout(new BorderLayout(0, 0));
      setContentPane(contentPane);
      
      
      buttonPanel = new JPanel();
      attackButton = new JButton("Attack");
      chraracterPanel = new JPanel();
      entityPanel = new JPanel();
      textArea = new JTextArea();
      textArea.setText("goon [Health: 10 of 10||Ammo: 0 of0||Cover: 20 of 20]");
      playerTextArea = new JTextArea();
      playerTextArea.setText("Name: Jan \r\nHealth: 10 of 10\r\nAmmo: 9 of9\r\nCover: 20 of 20");
      
      
   
      contentPane.add(buttonPanel, BorderLayout.SOUTH);
      contentPane.add(chraracterPanel, BorderLayout.EAST);
      contentPane.add(entityPanel, BorderLayout.NORTH);      
      contentPane.add(textArea, BorderLayout.CENTER);
      
      chraracterPanel.add(playerTextArea);
      buttonPanel.add(attackButton);
      
      textArea.setEditable(false);
      playerTextArea.setEditable(false);
      this.pack();
      this.setVisible(true);
      
      this.attackButton.addActionListener(this);
      
   }
   public void eventInsert(String event){
      this.textArea.append(event+"\n");
   }
   
   void displayCharacter(String name,
         int health, int maxHealth,
         int ammo, int maxAmmo,
         int coverHealth, int maxCoverHealth) {
         this.playerTextArea.setText(new String(
               
               "Name:"+name +"\r\n"+
               "Health:" +health+" of " +maxHealth+"\r\n"+
               "Ammo:"+ammo +" of" +maxAmmo +"\r\n"+
               "Cover:" +coverHealth   + " of " + maxCoverHealth));
               
         
   }
   
   @Override
   public void actionPerformed(ActionEvent e) {
      if(e.getActionCommand() == this.names[0]){
         System.out.println("attack works");
         Run.game.character.attack();
      }
      
   }
   public void reset() {
      this.textArea.setText("");
      
   }

}



Sorry but i don't think i'll officially give you the code since looking over this copy of the class file i consider it sloppy. It's also seems to be a really old version which is the main problem. If you want to use what i put up i'm fine with that but i'll try to find a later version (which i might not have anymore) for you to use.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Tue Mar 19, 2013 8:58 am

I know exactly what you mean with that, and that is one of the biggest things i want to work out, buttons lol...

and actually CoC was one of the big reasons i actually wanted to do this project, it was a big inspiration to me, though there were some things about it that i didn't like (mainly the story honestly) so i decided to work on my own project and run with it.



EDIT - I have a quick question for you, do you use Eclipse?
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 1:55 pm

Kagekaton Wrote:EDIT - I have a quick question for you, do you use Eclipse?

oh god yes. However i learned by using note pad ++ which allowed me to learn how to program without a IDE.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Tue Mar 19, 2013 7:55 pm

Alright, just wanted to make sure lol, that's what i'm using to do this, and as it is right now i'm working on getting a decent looking GUI, maybe try to add some buttons...possibly a rough HUD...not sure yet...
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 9:33 pm

Kagekaton Wrote:Alright, just wanted to make sure lol, that's what i'm using to do this, and as it is right now i'm working on getting a decent looking GUI, maybe try to add some buttons...possibly a rough HUD...not sure yet...

What are you using for the GUI, AWT or swing? Also, i likely have some code you can re purpose quite easily if that would help.

donate 2013 gui source files.zip
(4.17 KiB) Downloaded 18 times


Your going to have to clean these files up a bit and some of them you might not even need but i added them because they're require for that entire games GUI.
Map panel for instance you can ignore and just remove. (Still a cool class so i'd keep it around to look at when you get a chance.)

I'll likely add another version of this zip if my files aren't commented.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 10:01 pm

User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Tue Mar 19, 2013 10:29 pm

I'm using swing, and it's working really well, i have the start of a mini GUI going...not sure how i would show anyone though O.o

As for how my code looks right now...not sure if i would want to show you quite yet, i have a lot of comments in it (except for the start of the HUD...if you can even call it that >.<) and i can read the whole thing but i'm not sure how other people would handle it.

Before i go any further, just to double check, i can actually build the frame in one class, then use another class to put the input/output in the center of it right?
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Tue Mar 19, 2013 10:45 pm

in theory yes.

So what you could do is make a entirely new class that implements actionlistener, then add a button or something to the frame and use the method .addActionListener(); and use your class that implements actionlistener as the argument in addActionListener().

then when ever you hit the button, what ever action you have set in the method

public void actionPerformed(ActionEvent e) {}

that you added as the actionlistener will do that action.

i'm a little unclear as to what your trying to do.
GUI and Control panel are a perfect example of what i think you want to do; however control panel does use a inner class for the actionlistener but it's the same concept.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Wed Mar 20, 2013 3:32 am

well if you want to i could put up a runable file to show you what i have so far, i'm still not 100% on what i'm even doing, but i have a lot of basic concept ideas.

I'm hoping to use the left hand side of the screen for navigation, then when a fight starts maybe have it change to your combat actions, attack, spells, flee, etc. And on the main menu have it do the load and new game options...still working on getting that all sorted, and i did flip through GUI file, though i haven't had a chance to check out the control panel...though that may be what i'm looking for...


EDIT- So I think i have found a way to describe what i am currently working on! I got it to work, then i changed something, changed it back and it didn't work again...ANYWAY

I'm trying to get a JTextArea and a JTextField into my JFrame, the problem i'm encountering is when i create the JTextArea with JTextArea whathaveyou = new JTextArea("whatever"); then add it, framename.add(whathaveyou); it is just...blank...


upon closer inspection i've noticed that occasionally the text i have entered will appear...other times it is gone...

i just keep editing this thing tonight :D but i finally figured out what i did wrong, not sure why it was happening but my frame kept getting resized and just hit the text area...it was there i just couldn't see it in my frame....frame.setResizeable(false); for the win!

And that had it fixed until i decided i wanted to see the entire frame, now i am back at square one...scrapping this idea...
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Wed Mar 20, 2013 7:49 am

Kagekaton Wrote:well if you want to i could put up a runable file to show you what i have so far, i'm still not 100% on what i'm even doing, but i have a lot of basic concept ideas.

I'm hoping to use the left hand side of the screen for navigation, then when a fight starts maybe have it change to your combat actions, attack, spells, flee, etc. And on the main menu have it do the load and new game options...still working on getting that all sorted, and i did flip through GUI file, though i haven't had a chance to check out the control panel...though that may be what i'm looking for...


EDIT- So I think i have found a way to describe what i am currently working on! I got it to work, then i changed something, changed it back and it didn't work again...ANYWAY

I'm trying to get a JTextArea and a JTextField into my JFrame, the problem i'm encountering is when i create the JTextArea with JTextArea whathaveyou = new JTextArea("whatever"); then add it, framename.add(whathaveyou); it is just...blank...


upon closer inspection i've noticed that occasionally the text i have entered will appear...other times it is gone...

i just keep editing this thing tonight :D but i finally figured out what i did wrong, not sure why it was happening but my frame kept getting resized and just hit the text area...it was there i just couldn't see it in my frame....frame.setResizeable(false); for the win!

And that had it fixed until i decided i wanted to see the entire frame, now i am back at square one...scrapping this idea...


So look for something like "pack();" or "this.pack();'' and comment it out, and then you can get rid of the the this.setResizebale(false); assuming you can find that line of code.
pack(); resizes your window to the smallest possible size at the moment. just comment it out because i'd like to figure out why it was causing problems like you described since it shouldn't have unless your doing something odd which we need to fix.

Also for a system where you switch from a location picker to a combat system, i have just the thing.
So you're going to want to create 3 JPanels. One for locations and the other for combat. New you add a cardlayout to the third panel and place that were you want the other two panels will be. Now add both panel to the third panel and once you work out how card layout work, you should be able to make what you want.
I'm being vague so you can work out the fine details out by yourself but if you want a bit more help i'm willing to give it.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Wed Mar 20, 2013 8:21 am

I did find pack() and while it was...almost...what i need if i could just figure out how to keep it set to one size that would fit the entire thing i would be set! and after finding pack i pretty much deleted how i was doing it but if you like i could redo it for you, it's not complicated and i remember the ENTIRE thing...i rewrote it like 100 times...


To save you the hassle of reading the entire thing and me having to figure out how you posted the code in the spoiler...

JTextArea textarea = new JTextArea("example");
frame.add(textarea);


then when it didn't show i tried things like

frame.getContentPane().add(textarea, BorderLayout.CENTER *along with east and north and every other direction i could find*);

and now my fingers are tired again, but i also tried the GridBagConstraints, so far the only thing that has been consistent is pack() and even then it is TINY




Spoiler (click to show/hide):

Code: Select All Code
import javax.swing.*;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.*;
import java.util.Scanner;
public class Frame {

   public void frame(){
      //Begin frame set up
      JFrame frame = new JFrame("D-Day");
         frame.setVisible(true);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setSize(600, 600);
         
            //Frame set up
      //Begin Menu Bar Set up
      JMenuBar menubar = new JMenuBar();
            frame.setJMenuBar(menubar);
      
      JMenu file = new JMenu("File");
         menubar.add(file);
         
         
      JMenuItem exit = new JMenuItem("Exit");
         file.add(exit);
//Menu Bar is set up with file and exit
         //The class set up for making exit do something
   class exitaction implements ActionListener{
      
      public void actionPerformed (ActionEvent e){
         System.exit(0);
      }
      
   }
   //end of class
      //adding an action to the exit button, making it exit
   exit.addActionListener(new exitaction());
   
   //I need a panel
   
   JPanel panel = new JPanel(new GridBagLayout());
      frame.getContentPane().add(panel, BorderLayout.WEST);   //Borderlayout west to put them on the left               
            //Using the grid bag layout to align my buttons
         //Constraints to help align the buttons
      GridBagConstraints c = new GridBagConstraints();
      
      
   //Begin button set up
   
   JButton button1 = new JButton("Attack");
      c.gridy = 1;
      c.gridx = 0;
      c.insets = new Insets(10,10,10,10);
      panel.add(button1, c);
   JButton button2 = new JButton("Spells");
      c.gridy = 2;
      c.gridx = 0;
      c.insets = new Insets(10,10,10,10);
      panel.add(button2, c);
   JButton button3 = new JButton("Flee");
      c.gridy = 3;
      c.gridx = 0;
      c.insets = new Insets(10,10,10,10);
      panel.add(button3, c);
   
      //Finished the start of my buttons
      //New panel to hold the HUD
   JPanel panel2 = new JPanel(new GridBagLayout());
      frame.getContentPane().add(panel2, BorderLayout.SOUTH);
      GridBagConstraints c2 = new GridBagConstraints();
   //Finished start of panel for HUD
      
      //Going to try and use labels for HP then add an output for the actual remaining HP
   JLabel label1 = new JLabel("Player HP");
      panel2.add(label1, c2);
         c2.gridy = 0;
         c2.gridx = 1;
         c2.insets = new Insets(10,10,10,10);
   //Same with MP
   JLabel label2 = new JLabel("Player MP");
      panel2.add(label2, c2);
         c2.gridy = 0;
         c2.gridx = 2;
         c2.insets = new Insets(10,10,10,10);
         
      
   JTextArea textarea = new JTextArea("example");

      frame.add(textarea);
      frame.pack();
      
      
      
   }
   
   
         
}   

         
      
      
   


So...I figured it out...and now you can take a peek and tell me how disturbing my code is o.o
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Next

Return to Creative Corner



Who is online

Users browsing this forum: No registered users