Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 116 117 [118] 119 120 ... 796

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

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1755 on: February 27, 2012, 07:30:52 pm »

It's the temperature map for this:

Spoiler: EQUALLY LARGE IMAGE (click to show/hide)

Unfortunately, so far it's only a temperature map in theory. I kind of have to start applying it to the other features now...
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1756 on: February 27, 2012, 07:53:21 pm »

So today I had some free time at school, decided to start laying the groundwork for a dungeon crawler...
and it turns out that C doesn't have a String variable. WHAT.

According to the textbook (some 300-400 pages ahead of what we're currently working on), the way you work around it is with a modified char variable that stores the fake!String as a bunch of separate characters. Needless to say, I am not getting it to work properly yet.

Anyway, a more pertinent question: how do you tell the program to return to a different line or section of code? See, I only want players to use letters for their name (figuring out how to make this work led to the aforementioned discovery), but I don't want to simply shut down the program if the name is invalid. I assume it's some variation of "goto", but the exact syntax eludes me.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1757 on: February 27, 2012, 07:55:38 pm »

I think you're looking for break?
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1758 on: February 27, 2012, 07:59:04 pm »

So today I had some free time at school, decided to start laying the groundwork for a dungeon crawler...
and it turns out that C doesn't have a String variable. WHAT.

According to the textbook (some 300-400 pages ahead of what we're currently working on), the way you work around it is with a modified char variable that stores the fake!String as a bunch of separate characters. Needless to say, I am not getting it to work properly yet.

Anyway, a more pertinent question: how do you tell the program to return to a different line or section of code? See, I only want players to use letters for their name (figuring out how to make this work led to the aforementioned discovery), but I don't want to simply shut down the program if the name is invalid. I assume it's some variation of "goto", but the exact syntax eludes me.
...what does that groundwork even look like? I'm not even sure where to start. :/
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1759 on: February 27, 2012, 08:00:45 pm »

I think you're looking for break?
That might work. I'd have to fiddle with it first, the only time we've used break so far is for switches.

New question though:
Code: [Select]
for(;;)Are double semi-colons just a shorthand for "code goes here", or is it an argument of some sort?

@ MZ: Very, VERY early groundwork. Currently a bunch of mostly empty functions, calling each other to make sure various switches and if-statements work. It does have a nice-looking title picture though :P
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1760 on: February 27, 2012, 08:02:40 pm »

http://msdn.microsoft.com/en-us/library/d3e6x17s%28v=vs.80%29.aspx

Those are arguments which govern the functioning of the (loop) "For" statement. So that's shorthand for what you'd put in there for how you want your loop to run.

Code: [Select]
for ( x  =  0, x  <  z,  x++)
« Last Edit: February 27, 2012, 08:05:29 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1761 on: February 27, 2012, 08:05:22 pm »

Thanks for the link. I can already tell that some of this stuff is gonna come in handy.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1762 on: February 27, 2012, 08:07:26 pm »

Oh, I guess:

Code: [Select]
for (;;)
Has actual meaning, in that it will cause the loop to run infinitely unless you put in return, break or goto somewhere. So don't do that. Unless you should. :P
« Last Edit: February 27, 2012, 08:16:25 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1763 on: February 27, 2012, 08:19:53 pm »


Code: [Select]
for ( x  =  0 ; x  <  z ;  x++)

fixed that for you
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1764 on: February 27, 2012, 08:23:12 pm »

<---- Still hasn't programmed for crap, treat everything as psuedo code :P
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1765 on: February 27, 2012, 08:24:09 pm »


Code: [Select]
for ( x  =  0 ; x  <  z ;  x++)
If I'm reading that right, it starts x at 0, checks to see if x is less than z. If it's true, it adds 1 to x and reruns the loop. If false, it breaks the loop and moves on. Do I have the general concept?
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1766 on: February 27, 2012, 08:24:42 pm »

Yalp. I think your order of operations is right, although it may run the loop before it increments, I can't remember exactly where it does it.
« Last Edit: February 27, 2012, 08:27:09 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1767 on: February 27, 2012, 08:28:33 pm »

It checks first, runs the block of code, then increments. So the first iteration of the loop would be with x = 0.

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1768 on: February 27, 2012, 08:30:17 pm »

So if z had a value of say, 5, the loop would run 5 times before breaking off on the sixth run.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1769 on: February 27, 2012, 08:33:18 pm »

Nm, if it's less than 5 that's 5 runs.
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti
Pages: 1 ... 116 117 [118] 119 120 ... 796