Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 654 655 [656] 657 658 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903956 times)

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9825 on: July 14, 2016, 05:14:28 pm »

Isn't what you described the intuitive behaviour? if you want a click event attached to a specific HTML element then you have to tell the code which element you want it for. Any element can have click events, and/or you might want multiple buttons.

I'm guessing you originally wrote:

document.addEventListener("click", writeStats);

But that literally means to attach the event to every element on the page.

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #9826 on: July 14, 2016, 11:56:50 pm »

But that literally means to attach the event to every element on the page.
Yes, I know. Sorry, I worded it strangely.
Logged

Insanegame27

  • Bay Watcher
  • Now versio- I mean, age 18. Honestly not an AI.
    • View Profile
    • Steam ID
Re: if self.isCoder(): post() #Programming Thread
« Reply #9827 on: July 15, 2016, 03:02:43 am »

I have possibly maybe hopefully just got myself a job. As in an actual career job, not a once-off.


The IT guy at my stepdad's work has a brother who just went into a professional business. It just so happened that the IT guy's brother happened to mention to my stepfather that he was looking for an apprentice. My stepdad immediately volunteered myself and I had an interview about it yesterday, which went extremely well. I'll find out next week if I get the position or not.
Logged
Power/metagaming RL since Birth/Born to do it.
Quote from: Second Amendment
A militia cannot function properly without arms, therefore the right of the people to keep and bear Arms, shall not be infringed.
The military cannot function without tanks and warplanes, therefore the right of the people to keep and bear tanks and warplanes, shall not be infringed.
The military cannot function without ICBMs, therefore the right of the people to keep and bear ICBMs, shall not be infringed.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #9828 on: July 15, 2016, 04:36:53 am »

I have possibly maybe hopefully just got myself a job. As in an actual career job, not a once-off.
Good luck, you lucky bastard
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

TheDarkStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9829 on: July 15, 2016, 08:05:28 pm »

I've been doing stuff with SFML (a multimedia library) and my current project draws and zooms in on fractals (mostly the mandelbrot fractal). I got it working, but it was so and so I decide to multithread it.

I've never worked with multithreading before.

As it turns out, even enabling C++11, my IDE does not support multithreading without some changes with the compiler (which I'm not going to mess with yet because that could break everything). Luckily, SFML has its own implementation. The problem? Threads have to be declared at function initialization, which means their inputs need to be known at that time. However, I have to pass multiple types of data to get the functions to work correctly.

PPE: Nevermind, I realized that everything I need can either be a member variable that can be looked up by member functions or it can be passed to a function with a data type that holds multiple values (arrays, vectors, sf::Vector, etc). Basically, I spent an over an hour trying to solve a simple problem.
Logged
Don't die; it's bad for your health!

it happened it happened it happen im so hyped to actually get attacked now

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9830 on: July 15, 2016, 08:09:48 pm »

Pretty sure an alternative C++ way to get around that problem would be to just pass around void pointers and manually cast them back to whatever they were supposed to be (which is horrifying, of course :P).
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #9831 on: July 15, 2016, 11:09:29 pm »

I have possibly maybe hopefully just got myself a job. As in an actual career job, not a once-off.
Good luck, you lucky bastard
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #9832 on: July 18, 2016, 02:14:41 am »

Spoiler (click to show/hide)

I can't seem to get this updateFields() function to work properly and update the Derived Stats fields. Something is possibly wrong with my weaponAttack() function as well.

The problems as I see them:
- proficiency1 needs to be declared in order to be used in the rest of the function but I'm not sure how to do this without making another button, which would be ridiculous. Is there some way I can do this with logic inside the updateFields() function?
- weaponAttack1() and weaponTriangleHit() have a similar problems to the above, I think. I'm also wondering if the way I set the functions up is going to return a single numerical value like I intended.

HTML
JavaScript

Edit: Stuff has changed since this post. The problems evolved. Yay.
« Last Edit: July 19, 2016, 01:22:06 am by GUNINANRUNIN »
Logged

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #9833 on: July 19, 2016, 01:33:23 am »

Can anyone suggest a good c++ date (or date/time) class implementation?

Hard mode: don't use the word "boost"
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9834 on: July 19, 2016, 01:39:34 am »

There are quite a few time functions built into C++, especially since C++11, including various ways to store, calculate and format times. But you'd need to find ones that are suitable to your needs. And probably wrap them up in a small class to make them easy for you to use. It really depends on exactly what you need.
« Last Edit: July 19, 2016, 02:35:00 am by Reelya »
Logged

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #9835 on: July 19, 2016, 05:20:22 am »

This date handling library, which is sort of a natural extension of <chrono> for use with dates, is looking promising so far.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9836 on: July 25, 2016, 09:36:55 pm »

Is it weird that, after not looking at a piece of code for a while, I come back to it and it looks like a worthless pile of spaghetti? No matter how well-planned and elegant it seemed in the moment?
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9837 on: July 26, 2016, 01:52:10 am »

Is it weird that, after not looking at a piece of code for a while, I come back to it and it looks like a worthless pile of spaghetti? No matter how well-planned and elegant it seemed in the moment?


it's normal. it's the 'shit in a can' effect. when you don't remember the shit is yours, it smells awful.
Logged

Antsan

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9838 on: July 26, 2016, 05:14:55 am »

I am actually quite proud that recently I did some work on a library I effectively abandoned years ago and I understood everything almost perfectly.

But yeah, most of the time coming back to old code requires some reading, thought and experimentation to figure out what is going in.
Logged
Taste my Paci-Fist

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #9839 on: July 26, 2016, 05:20:53 am »

I have a game I've been working on since the start of last year, and a good 40% of it is eldritch mystery to me now
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.
Pages: 1 ... 654 655 [656] 657 658 ... 796