« first day (2822 days earlier)      last day (2110 days later) » 

12:00 AM
"Keep on going and the chances are you will stumble on something, perhaps when you are least expecting it. I have never heard of anyone stumbling on something sitting down." -Charles F. Kettering (source)
 
 
1 hour later…
1:25 AM
Is it possible to use a method call that is universal based on a user's decision? So if I had multiple Characters ( Magnar, Camran, Legolas ). I want to be able to call upon a method called .getStrength() but make the object name vary depending on the Users character choice.
Is this a thing?
So if they choose Magnar further in the code it will use Magnar.getStrength(), similarily Legolas will end up being Legoloas.getStrength(). Therefore, cutting down on code because I won't have to write up an option menu specific to each character?
 
 
3 hours later…
4:25 AM
@Twissted Maybe by using reflection
 
4:55 AM
Maybe something with Class.forName(String className) ?
 
 
3 hours later…
Zoe
7:40 AM
Morning
 
user8622974
Morning
 
Morning.
 
Mornin!
 
Zoe
8:16 AM
Hiya geis ^^
 
9:13 AM
HELLO GAIS
i have a constructor that passes a BufferedImage as image and i have a private variable called image and when i do this.image = image inside the constructor the field image is still null. Why is this?
it's private BufferedImage image as the field
 
Zoe
9:43 AM
//mcve GoldShovel
 
user8622974
Please create an MCVE @GoldShovel
 
okay for one, i did try rewriting, and what I expected to happen was that my field image would be set to whatever I passed to my constructor. The code is here: paste.ofcode.org/37Gdy8exeDZdj5RMsq3giNd
 
Zoe
Looks fine. Do you pass a non-null value when you initialize it?
 
no, as when i do g.drawImage(the image i passed to the constructor) it draws it.
 
Zoe
You said the image in the spritesheet is null and said that was the problem.
 
9:50 AM
it's saying it's null
but im passing a valid image to it
and when it tries setting this.image = image; image (the field) is null
 
Zoe
Are you using IntelliJ?
 
Zoe
You should make sure the loading isn't null. If you pass null to the constructor of the class, or failed loading results in null, that's something you should catch. Add a null-check. (I asked for IntelliJ since you could add a @NotNull annotation from a JetBrains package and get the same result. If you're not using IntelliJ it's just easier adding a manual null-check). Throw an exception if it's null in the constructor.
(if you initialize the SpriteSheet with a null value, you don't need it. But if there's a chance it's null that's not guaranteed, you should have a null check, assuming the reason it might be null doesn't throw it's own exception)
 
paste.ofcode.org/Kppssj42QwJStERbRmLChe debug statments with the null check i added comments to where the weird behavior happens
 
Zoe
Wait, is it null when you use the subImage method?
 
9:58 AM
let me check
 
Zoe
as in image isn't null when it's called, but the result returned is null?
 
I think it is null when i run the crop() method
 
Zoe
Is null or returns null?
if it is null, is that the entire class? Do you in any way change the BufferedImage instance somewhere? Aside the this.image = image of course.
 
no i don't change image anywhere else
1 sec
BufferedImage test = sheet.cropImage(0, 0, 10, 10); returns an NPE and cropImage is that subImage method
yeah it's only null when that method is run i've no idea why..
 
11:11 AM
apparently other people have had issues with this
but i can't see the problem.
 
11:51 AM
Ah, dangit. Too late again!
 
too late for what
 
For some good discussion and stuff
 
oh
uh i still have that problem? xd..
great discussion
 
Hm, I will try to replicate that, hang on for a while ^^
 
Fish use a variety of low-pitched sounds to convey messages to each other. They moan, grunt, croak, boom, hiss, whistle, creak, shriek, and wail. They rattle their bones and gnash their teeth. However, fish do not have vocal chords. They use other parts of their bodies to make noises, such as vibrating muscles against their swim bladder. (source)
 
12:02 PM
lmao!
ok thank you geister
 
Do you have more code around it? The only thing that came to my mind would be multiple threads causing that behaviour? Or is everything on the same thread?
 
i am making one thread
using Thread thread = new Thread(this);
and no that's the whole class
if you want i can give my "Game" class where i use it
 
I threw together this ugly thing here and this works in the sense that there is no NullPointerException.
 
intead of making a new instance i call it like Class.method()
is that why?
 
That shouldn't be possible because you don't use static methods and stuff
@GoldShovel Yeah the code that uses the constructor and the method.
*would help
 
12:13 PM
oh sorry i don't do that
1 sec.....
 
12:23 PM
look at the init method to see how i do it
 
SpriteSheet sheet = new SpriteSheet(GetImage.getImage("/textures/sheet.png"));

creates a new local variable. You don't set the variable defined in the class
 
Zoe
^
 
How can I use bootstrap 4 in spark freamworks?
 
@th3g3ntl3man Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
 
Zoe
@th3g3ntl3man Download the files, add them to your project, reference them from your code like any other .css file
 
12:37 PM
@Zoe It's so simple? Thank you very much!
 
12:53 PM
oh
would i need to make it static if i want to set it in the class
 
1:08 PM
Nope. You just have to remove SpriteSheet from the line. Make it sheet = new SpriteSheet(GetImage.getImage("/textures/sheet.png"));
That way you don't create a local variable but instead reference the class field
 
oh im an idiot
thank you
 
No problem :)
 
still an npe o.o it makes sense what you've said
but still somehow an npe
 
1:21 PM
GetImage.getImage("/textures/sheet.png") 100% does not return null?
 
mhm
because when i g.drawImage with that it's fine
 
Right, you mentioned something like this.
Where do you use the sheet?
 
in my code it shows everywhere i se it
use
only in that class
and for loading sprites obviously.
 
1:45 PM
HI guys
i am getting one exception in SOAP
Jul 13, 2018 3:56:26 PM com.sun.xml.ws.transport.http.HttpAdapter fixQuotesAroundSoapAction

INFO: Received WS-I BP non-conformant Unquoted SoapAction HTTP header: com.tcs.mobapps.webservice/authenticate
any one have idea
i am using JAX-ws ri implementation
it works fine but after some time i get null pointer exception because of this
 
Zoe
2:21 PM
@geisterfurz007 Shouldn't that be textures/sheet.png?
At least on UNIX systems, /something/else leads to the root of the drive
 
1 hour ago, by GoldShovel
because when i g.drawImage with that it's fine
Guess that works.
 
Zoe
/shrug
 
¯\_(ツ)_/¯
 
yeah
but not g.subimage
getsubimage*
why the hellllll is getSubimage returning a NPE
okay so further testing shows it's definitely when the method is called
It has comments in there too
 
2:48 PM
so sheet is null and not image.
 
i think so.
 
Show the code where you do something with sheet.
 
let me run 1 more test
ok
ah yeah it is null..
 
Oh!
You might want to call your init method before starting the thread
 
i will try that.
damn!!!!!
IT WORKS! How stupid. do you mind explain why that is the case?
 
2:55 PM
You start the thread, tick and render are called (technically not exactly) parallel to the init method. If the stuff in the thread is faster, it tries to access sheet which is not yet initialized.
 
ah. makes sense.
 
Moving init before starting the thread ensures that sheet is not null before it is run
 
thank you once again.
yep
now i need a class to handle da spritessss
 
im not new to java (kind of.) but definitely new to Threads and BufferImages etc
thank you.
 
2:58 PM
No problem!
 
do you know how to make a good sprite sheet
in like paint.net or anything
 
I have absolutely no clue, sorry
 
eh it's ok ill use one online
and another question how good are you at java would you say
 
OOf! Hard to say.
I can get one thing done or the other but I am not familiar with some of the big frameworks
 
ah
you heard of that joke about 5 js developers locked in a room to make a web page using no libraries or anything
and they were never seen again :P
 
3:05 PM
ha!
 
yeah
what bout it
 
Could anybody take a look at this and see if they feel it's possible to pass a universale variable
Like
 
i don't get what you mean
 
So if I want to pass a variable based on the user's decision to be either Magnar or Zifaris
I want to make a menu to create stats that is universal to the users decision on which character they chose
So I don't have to write out the menu for Strength and Armour multiple times for each character
Does that make sense?
 
More or less. Do you just want to pass a unique value that indicates the choice or something different?
 
3:59 PM
I mean I would like to be able to pass a object name based on the users decision so instead of writing out this large menu of 800 lines of code I could shorten it to one menu that is universal to all 4 characters
Like I have currently a setup that is about 400 lines of code for Specifically Magnar
That you can increase or decrease a stat of Str, Armour, Dex, and Moxie
 
Zoe
Happy Sunday @Michael!
 
You want to pass an object name or an object?
 
Object name
 
Heya @Zoe!
 
Which I know you can do
 
4:01 PM
uh hii :P
 
Zoe
@Michael How's life? :D
 
@Michael !!! o/
 
In the line Humanoids.getClassAttributeRating, I could substitute classSelected for Magnar but that doesn't really shorten my code in anyway. I am still forced to create 4 different versions of the stat menu for each character
 
What would that object name do for you? I still don't really get what you want to accomplish. If you pass a String (which would be what I consider an object name) that could only be used in the way you do now with a switch statement.
 
Sup @gei
 
4:05 PM
What you can do is have a Map<String, Humanoids> somewhere where you could access your instance from.
 
This is my long buttload of code i'm currently using to just increase and decrease stats for one character
 
@Zoe Wonderful.
 
I feel there must be a way to shorten this to be universal to all 4 characters I want to create
I figured making a method that may possibly be more universal would be easiest but I can't fathom how. I've tried a few different things but they all end up with just as much code lol
 
Yes. Use a method O-o Or better: More methods! The only thing that appears to be different in those (at least on first glance) is the attribute name
 
Zoe
^
 
4:07 PM
more methods!!
 
Zoe
Generalize it to take in the current attrib name, value, and an instance
you could boil that down to one method and do casting as necessary for class-specific stats
 
I am trying to make it into one method so I don't need to make 4 versions of it which is my issue at the moment. I wish I could make the classSelected variable equal to say "Magnar" then in the method being called use this "Magnar".get() but that doesn't work lol
 
To access the methods for each character you can do two things: One would be not using static methods but instance methods instead. That way you can have a Map<String, Humanoids> and access the objects with the className. Other way would be accessing the method using reflection. For that you would have to look that stuff up because I don't know out of my mind how it works.
 
And I haven't learned Map <String, Humanoids> yet. I may just be getting ahead of myself
I was having fun figuring this out and making it more into a game
 
Either way: The first thing that would probably be best for you to extract some code to methods to clear stuff up.-
 
4:16 PM
Yeah i'm trying to figure out how I could go about that right now because it is incredibly messy with such a large amount. Which is why I wanted to try to make it more universal which would cut down the code entirely. Seeing as I have to make 4 versions of it i'm sitting on a mountain of code xD
I'll figure it out :) appreciate the inputs
 
Good luck!
 
Thanks
 
 
3 hours later…
6:53 PM
I have a quick question for anybody around. I am making a do-while statement that I want to end when either currentHP = 0 or the evilTwinHP = 0. This is the current do-while statement I am using but it does not end when one of them reaches 0. Thoughts? paste.ofcode.org/aCFRUUvvqcZhNQQcuLLE8x
 
@Twissted change || to &&
 
Really lol
 
question
how should that affect anything
 
It works
Is it because the statement is checking to see if both are true. And if one is false then it breaks the loop?
Vs. the Or will be checking to see if one of them is true. And if at least one is true it will keep looping?
 
Yes
 
Zoe
7:36 PM
@GoldShovel It loops while either of the hitpoint counts are above 0. If it should stop looping when one of them is < 100, that means the condition char1HP > 0 && char2HP > 0 is false collectively when either is 0. If you have or, that means it keeps looping as long as one of them is > 0
 
7:54 PM
ohhhhh
thank you.
 
8:44 PM
anyone up for some quick logic that im too stupid to figure out
paste.ofcode.org/i7uMUP465VgG4ELgxsUKJk is my code with the comments
im just to silly to know what logic to use for y
 
@GoldShovel change y > 0 to y < 0
 
can't move down when i go up
dw i got it.
Thanks for that little tip
ah..
so the top and left sides work, however my sprite can still go past the right side and bottom side only a small bit, any clue why?
 
/shutdown
 
they do eventually stop, it's just not at the border of the JFrame.
 
Shutting down. See you later.
 
8:57 PM
shutdown, that's not me and it's shutdown.
 
9:54 PM
OakBot Online.
 
/cat
 
10:07 PM
The property names in the bot.properties file are a lot more organized now.
 

« first day (2822 days earlier)      last day (2110 days later) »