Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 582 583 [584] 585 586 ... 796

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

Moghjubar

  • Bay Watcher
  • Science gets you to space.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8745 on: January 09, 2016, 01:35:58 am »

...may I ask what you're making?
I'm not him, but it's either a strategy game on a hexagonal grid, an rpg on a hexagonal grid, or a bunch of hexagonal cells with a couple goombas in one.

Goombas on a grid: Mario Tactics confirmed.
Logged
Steam ID
Making things in Unity
Current Project: Demon Legend
Made This too (publisher abandoned ) Farworld Pioneers
Mastodon

Magnumcannon

  • Bay Watcher
  • Deep waters don't run still
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8746 on: January 10, 2016, 07:15:28 pm »

I'm using Java and i have run into this problem when using methods. I thought they would be pretty straight-foward and i'm actually following the example of a working code (i'm studying programming through a book). Here is my code:
Spoiler (click to show/hide)

And here is the error i'm getting
Spoiler (click to show/hide)

I have no idea why it's it's asking a semi-colon. I used this code as base for mine and it worked fine.
Spoiler (click to show/hide)
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8747 on: January 10, 2016, 07:17:21 pm »

What even...
You're attempting to define a method inside another method?  Can you even DO that?
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

Magnumcannon

  • Bay Watcher
  • Deep waters don't run still
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8748 on: January 10, 2016, 07:19:23 pm »

What even...
You're attempting to define a method inside another method?  Can you even DO that?
facepalms

Thank you so much. This small mistake almost drove me crazy :P . I think i must have got used to Python.
Logged

Bauglir

  • Bay Watcher
  • Let us make Good
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8749 on: January 10, 2016, 07:21:06 pm »

What even...
You're attempting to define a method inside another method?  Can you even DO that?
You can in some languages, and there are sometimes good reasons to do it.

I dunno about Java, though, and it's not something I, personally, have ever needed to do, so I can't give any sensible examples.
Logged
In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.
“What are you doing?”, asked Minsky. “I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman replied. “Why is the net wired randomly?”, asked Minsky. “I do not want it to have any preconceptions of how to play”, Sussman said.
Minsky then shut his eyes. “Why do you close your eyes?”, Sussman asked his teacher.
“So that the room will be empty.”
At that moment, Sussman was enlightened.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8750 on: January 10, 2016, 07:24:41 pm »

What even...
You're attempting to define a method inside another method?  Can you even DO that?
You can in some languages, and there are sometimes good reasons to do it.

I dunno about Java, though, and it's not something I, personally, have ever needed to do, so I can't give any sensible examples.

Java's aggressively object-oriented. I'm not sure if it has anything resembling functions that aren't methods.

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #8751 on: January 10, 2016, 08:04:14 pm »

...may I ask what you're making?
I'm not him, but it's either a strategy game on a hexagonal grid, an rpg on a hexagonal grid, or a bunch of hexagonal cells with a couple goombas in one.

Goombas on a grid: Mario Tactics confirmed.
It's just a placeholder. :P Also yes.


I'll try out some of the suggestions I got and report back.
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

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #8752 on: January 10, 2016, 11:32:15 pm »

What even...
You're attempting to define a method inside another method?  Can you even DO that?
You can, in languages that are first-class objects! (Or whatever,  I don't remember the exaact term)

It's quite important in functional styles of programming..
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

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8753 on: January 11, 2016, 01:06:26 am »

In C++ you can't make nested functions, but you can define a struct inside a function, then give that an () operator and use it like a function :D

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #8754 on: January 11, 2016, 01:08:59 am »

I think you can make classes inside classes in Python (I've never had need to do such a thing, surprisingly), and then make methods inside those.
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.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #8755 on: January 11, 2016, 04:22:13 am »

Yep.

You can make classes within functions, classes within classes, and functions within functions.

The function inside function part is quite useful
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

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8756 on: January 11, 2016, 10:15:51 pm »

Alright, this is stupid but I can't think of keywords to google it.

In Python with the default IDE after using ctrl+f to find something I could hit ctrl+g to keep finding the same term without having to reopen the find dialogue.  This is useful for me because I sometimes, ah, go through a large document and change the same thing dozens of times due to poor planning.

How do I do that in visual studio (specifically VS 2015 community edition)?
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8757 on: January 11, 2016, 10:34:30 pm »

Ctrl+shift+f will open a find window that can do that, or you can just press f2 on a variable or function to rename all instances of it.
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #8758 on: January 11, 2016, 10:39:54 pm »

Well, if you can't put up with interface inconvenience, you might want to use something other than IDLE.
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.

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8759 on: January 11, 2016, 10:41:59 pm »

This is not strictly a programming question, but I fugre it's probably relevant enough.
Does anyone know of an easy-to-use screen/audio capturer for Windows that supports .mp4?
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.
Pages: 1 ... 582 583 [584] 585 586 ... 796