Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 78 79 [80] 81 82 ... 91

Author Topic: Programming Help Thread (For Dummies)  (Read 100501 times)

JanusTwoface

  • Bay Watcher
  • murbleblarg
    • View Profile
    • jverkamp.com
Re: Programming Help Thread (For Dummies)
« Reply #1185 on: September 09, 2013, 04:48:44 pm »

What do you mean by nothing working? Are you getting any errors or is the image just not showing up?

My first thought was that the image might be loading asynchronously--I remember that happening in the past with Java--but I think that ImageIO avoids that issue.

My second thought is to make sure the image is loading. Within the try, just after the 'img = ...' line, try printing out the images width and height. If it gets the right numbers, you're on the right track at least.
Logged
You may think I'm crazy / And I think you may be right
But life is ever so much more fun / If you are the crazy one

My blog: Photography, Programming, Writing
Novels: A Sea of Stars, Confession

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1186 on: September 09, 2013, 04:51:10 pm »

Hello all!  Any suggestions of a good language/library/tutorial for making a MUD?  I'm familiar with C++ and Python.

JanusTwoface

  • Bay Watcher
  • murbleblarg
    • View Profile
    • jverkamp.com
Re: Programming Help Thread (For Dummies)
« Reply #1187 on: September 09, 2013, 05:43:54 pm »

Something that does as much of the underlying work (particularly the networking) as is possible. :) Writing an engine can be all sorts of fun, but it makes it far less likely that you'll ever actually finish anything.

Evennia might do what you want. It's an open-source Python framework for building MU* games. It looks a bit dense but powerful.

(Heck, now you've got me interested in writing one. :)
Logged
You may think I'm crazy / And I think you may be right
But life is ever so much more fun / If you are the crazy one

My blog: Photography, Programming, Writing
Novels: A Sea of Stars, Confession

Lost in Nowhere

  • Bay Watcher
  • AHAHAHAHA~!
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1188 on: September 09, 2013, 09:26:03 pm »

What do you mean by nothing working? Are you getting any errors or is the image just not showing up?

My first thought was that the image might be loading asynchronously--I remember that happening in the past with Java--but I think that ImageIO avoids that issue.

My second thought is to make sure the image is loading. Within the try, just after the 'img = ...' line, try printing out the images width and height. If it gets the right numbers, you're on the right track at least.
In the initialization, I test this method, and when I run it, it crashes, saying:
Code: [Select]
javax.imageio.IIOException: Can't read input file!This happens from the line inside the try statement which attempts to load the file.
And by nothing working, I mean that everything that I have tried did not work.
Logged
And so I strike, like an unseen dodge ball in an echoing gymnasium!
Another book entitled Start Your Day with Extinction.
Must be the next book in the series after Start Your Day with Death.

JanusTwoface

  • Bay Watcher
  • murbleblarg
    • View Profile
    • jverkamp.com
Re: Programming Help Thread (For Dummies)
« Reply #1189 on: September 09, 2013, 10:21:04 pm »

In the initialization, I test this method, and when I run it, it crashes, saying:
Code: [Select]
javax.imageio.IIOException: Can't read input file!This happens from the line inside the try statement which attempts to load the file.
And by nothing working, I mean that everything that I have tried did not work.

Third thought: The file doesn't exist or Java cannot find it. Make sure it's there with this:
Code: [Select]
System.out.println("File is readable: " + (new File(Garden.directory, path).canRead()));

As a side note, you should use the new File(parent, child) constructor to build paths just in case you want to run on non-Windows systems. It will fill in the path separator for you.

Third and a half thought: Make sure that the directory is set correctly. Since you're developing in Eclipse, the program will run in the project root by default, IIRC, so paths should be relative to that rather than the source or binary folders. (I think).

Fourth thought: Make sure that you're reading a supported file format. By default ImageIO can handle GIF, PNG, JPEG, BMP, and WBMP. You can check what's supported with ImageIO.getReaderFileSuffixes() or friends.
Logged
You may think I'm crazy / And I think you may be right
But life is ever so much more fun / If you are the crazy one

My blog: Photography, Programming, Writing
Novels: A Sea of Stars, Confession

Lost in Nowhere

  • Bay Watcher
  • AHAHAHAHA~!
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1190 on: September 09, 2013, 10:33:41 pm »

It's trying to read a .png that definitely exists.
Anyways, don't have much time now.
~ EDIT ~
Now that I have enough time to do this:
Code: [Select]
File is readable: false
javax.imageio.IIOException: Can't read input file!
Spoiler: Large image (click to show/hide)
I have no idea what I'm doing wrong.
~ EDIT 2 ~
Just discovered that the path I was using was missing a folder, so...
I was thinking the problem was some stupid little mistake (like this).
Really, that was the entire problem.
« Last Edit: September 10, 2013, 08:54:01 am by Lost in Nowhere »
Logged
And so I strike, like an unseen dodge ball in an echoing gymnasium!
Another book entitled Start Your Day with Extinction.
Must be the next book in the series after Start Your Day with Death.

Johuotar

  • Bay Watcher
    • View Profile
    • Some game projects
Re: Programming Help Thread (For Dummies)
« Reply #1191 on: September 18, 2013, 12:13:36 pm »

Hi everybody, I'm trying to practise some OOP in C# and I'm having a problem with calling a method. The code is a mess so I highlighted the parts that are giving errors. All the greened code is just there for temporary testing. I tried making the methods static but it only created new errors.


An object reference is required for the non-static field, method, or property 'DebtedAdventurer.Program.Choise1'   C:\Users\Johuotar\Dropbox\Omat tiedostot\Omia ohjelmointeja\DebtedAdventurer\DebtedAdventurer\Program.cs   177   21   DebtedAdventurer

Spoiler (click to show/hide)
Logged
[img height=x width=y]http://LINK TO IMAGE HERE[/img]
The Toad hops in mysterious ways.
This pure mountain spring water is indispensable. Literally. I'm out of paper cups.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Programming Help Thread (For Dummies)
« Reply #1192 on: September 18, 2013, 08:44:08 pm »

You should highlight the line where the error occurs .
It looks like you're calling a function that isn't static like this:
ClassName.memberfunction(). The proper way would be calling it by "ClassName instance = new ClassName(); instance.memberfunction();"
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

mainiac

  • Bay Watcher
  • Na vazeal kwah-kai
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1193 on: September 18, 2013, 09:40:25 pm »

I've been writing a program in python using tkinter and I can't get it to recognize right mouse clicks.  It recognizes left mouse clicks and middle mouse clicks just fine.  Maybe it's a longshot, but anyone got suggestions what could be causing this?
Logged
Ancient Babylonian god of RAEG
--------------
[CAN_INTERNET]
[PREFSTRING:google]
"Don't tell me what you value. Show me your budget and I will tell you what you value"
« Last Edit: February 10, 1988, 03:27:23 pm by UR MOM »
mainiac is always a little sarcastic, at least.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1194 on: September 19, 2013, 08:04:49 am »

Hi everybody, I'm trying to practise some OOP in C# and I'm having a problem with calling a method. The code is a mess so I highlighted the parts that are giving errors. All the greened code is just there for temporary testing. I tried making the methods static but it only created new errors.


An object reference is required for the non-static field, method, or property 'DebtedAdventurer.Program.Choise1'   C:\Users\Johuotar\Dropbox\Omat tiedostot\Omia ohjelmointeja\DebtedAdventurer\DebtedAdventurer\Program.cs   177   21   DebtedAdventurer

Choise1 needs to be static if you're accessing it from a static function.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

SethCreiyd

  • Bay Watcher
  • [VESPERTINE]
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1195 on: September 19, 2013, 08:14:10 am »

I've been writing a program in python using tkinter and I can't get it to recognize right mouse clicks.  It recognizes left mouse clicks and middle mouse clicks just fine.  Maybe it's a longshot, but anyone got suggestions what could be causing this?

Can you post the code?  All I could say offhand is that <Button-2> is for the middle button and <Button-3> is for the right.
Logged

mainiac

  • Bay Watcher
  • Na vazeal kwah-kai
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1196 on: September 19, 2013, 12:41:06 pm »

I've been writing a program in python using tkinter and I can't get it to recognize right mouse clicks.  It recognizes left mouse clicks and middle mouse clicks just fine.  Maybe it's a longshot, but anyone got suggestions what could be causing this?

Can you post the code?  All I could say offhand is that <Button-2> is for the middle button and <Button-3> is for the right.

The event in question starts at line 265, change line 298 if you want to change between right and middle mouse button.  It could also be a problem with my system and will work fine for you, which is feedback I'd appreciate.

Spoiler (click to show/hide)
Logged
Ancient Babylonian god of RAEG
--------------
[CAN_INTERNET]
[PREFSTRING:google]
"Don't tell me what you value. Show me your budget and I will tell you what you value"
« Last Edit: February 10, 1988, 03:27:23 pm by UR MOM »
mainiac is always a little sarcastic, at least.

olemars

  • Bay Watcher
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1197 on: September 19, 2013, 06:58:24 pm »

Not very familiar with python, but presumably the second bind of button 3 (line 306) takes presedence over the first one since it's in the same scope and object.
Logged

mainiac

  • Bay Watcher
  • Na vazeal kwah-kai
    • View Profile
Re: Programming Help Thread (For Dummies)
« Reply #1198 on: September 19, 2013, 08:26:24 pm »

Help what do I do, my palm is stuck to my face.
Logged
Ancient Babylonian god of RAEG
--------------
[CAN_INTERNET]
[PREFSTRING:google]
"Don't tell me what you value. Show me your budget and I will tell you what you value"
« Last Edit: February 10, 1988, 03:27:23 pm by UR MOM »
mainiac is always a little sarcastic, at least.

Johuotar

  • Bay Watcher
    • View Profile
    • Some game projects
Re: Programming Help Thread (For Dummies)
« Reply #1199 on: September 20, 2013, 04:07:43 am »

Thanks for the answers, I think Ill read the OOP chapter again. Im obviously missing some basics here.
Logged
[img height=x width=y]http://LINK TO IMAGE HERE[/img]
The Toad hops in mysterious ways.
This pure mountain spring water is indispensable. Literally. I'm out of paper cups.
Pages: 1 ... 78 79 [80] 81 82 ... 91