September 07, 2025, 10:00:40 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Wondering where all the forums have gone?

Join the community Discord server!

Pages: 1 ... 7 8 [9] 10 11 ... 15

Author Topic: ITT we make fun of stupid stuff in GML  (Read 42534 times)

notarctic

  • just arctic, what gives?
  • ******
  • Karma: 8
  • Offline Offline
  • Posts: 4864
  • 👎👀 bad aim ba̷̶ ԁ aIm 👎 thats❌ some bad 👎👎aim
Re: ITT we make fun of stupid stuff in GML
« Reply #120 on: October 27, 2013, 08:50:33 pm »

gml once gave me an error for a ' i had in a commented line
Logged
[1:37:51 PM] Derpduck: arctic u need to quote ppl that make shit posts in case they edit them
[4:20:15 PM] Rubeus Hashgrid: i cant discover anything fuck you imageshack

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: ITT we make fun of stupid stuff in GML
« Reply #121 on: October 30, 2013, 10:31:47 am »

Yeah, gml parsing of comments is sometimes really strange.

Code: [Select]
/*hhh/*/Haven't tested, but if I recall correctly this breaks.
« Last Edit: October 30, 2013, 10:32:30 am by Orpheon »
Logged

Vindicator

  • Developer
  • ******
  • Karma: 84
  • Offline Offline
  • Posts: 2398
    • http://www.kylemoy.org/
Re: ITT we make fun of stupid stuff in GML
« Reply #122 on: November 02, 2013, 10:22:25 pm »

I still can't get over this from a few months ago. I recently re-discovered the problem and looked more into it, but it turns out it's not really GML's fault;

Code: [Select]
GML:
(-120) mod 360 == -120

Python:
(-120) % 360 == 240

Wolfram Alpha:
(-120) % 360 == 240

Google:
(-120) % 360 == 240

So, the answer I was looking for is definitely 240, because I was working with angles, and negatives would break lots of things. However, that's also what I expected to be the proper implementation of modulo.

I had been laughing at GML for the incorrect implementation of modulo, but to my suprise I recently discovered Java does the same thing as well!

Code: [Select]
Java:
(-120) % 360 == -120

Curious.

As it turns out, the implementation of modulo isn't exactly universally accepted.
http://en.wikipedia.org/wiki/Modulo_operation#Common_pitfalls

wat.

Anyway, I wrote my own modulus for the time being.
Code: [Select]
return argument0 - argument1 * floor(argument0 / argument1);
« Last Edit: November 02, 2013, 10:28:01 pm by Vindicator »
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12519
  • Another one --
Re: ITT we make fun of stupid stuff in GML
« Reply #123 on: November 03, 2013, 12:04:17 am »

((x mod y) + y) mod y
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

MedO

  • Owns this place
  • *****
  • Karma: 152
  • Offline Offline
  • Posts: 1757
Re: ITT we make fun of stupid stuff in GML
« Reply #124 on: November 03, 2013, 12:58:31 pm »

Logged
Quote from: Alfred North Whitehead
It is the business of the future to be dangerous; and it is among the merits of science that it equips the future for its duties.

Quote from: John Carmack
[...] if you have a large enough codebase, any class of error that is syntactically legal probably exists there.

ajf

  • (Ex-?)Developer and forum/web admin
  • *****
  • Karma: 7
  • Offline Offline
  • Posts: 3415
  • she's never quite as dead as you think
Re: ITT we make fun of stupid stuff in GML
« Reply #125 on: November 03, 2013, 02:57:34 pm »

(x + y) mod y
ftfy
this only works where -y < x < y, but not for -2y < x < 2y
Logged
did you know that spinning stars work like this???

I've seen things you people wouldn't believe. execute_strings on fire off the shoulder of Overmars. I watched object-beams glitter in the dark near the room_goto_fix. All those moments will be lost in time, like tears...in...rain. Time to die.

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12519
  • Another one --
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

ajf

  • (Ex-?)Developer and forum/web admin
  • *****
  • Karma: 7
  • Offline Offline
  • Posts: 3415
  • she's never quite as dead as you think
Re: ITT we make fun of stupid stuff in GML
« Reply #127 on: November 03, 2013, 04:01:06 pm »

((x mod y) + y) mod y
x = -195
y = 10

((-200 mod 10) + 10) mod 10
(-5 + 10) mod 10
5 mod 10
5

(x + y) mod y
ftfy
x = -195
y = 10

(-195 + 10) mod 10
-185 mod 10
-5

wareya's right and we're both wrong?
Logged
did you know that spinning stars work like this???

I've seen things you people wouldn't believe. execute_strings on fire off the shoulder of Overmars. I watched object-beams glitter in the dark near the room_goto_fix. All those moments will be lost in time, like tears...in...rain. Time to die.

MedO

  • Owns this place
  • *****
  • Karma: 152
  • Offline Offline
  • Posts: 1757
Re: ITT we make fun of stupid stuff in GML
« Reply #128 on: November 03, 2013, 05:24:35 pm »

Augh, you're right of course.
Logged
Quote from: Alfred North Whitehead
It is the business of the future to be dangerous; and it is among the merits of science that it equips the future for its duties.

Quote from: John Carmack
[...] if you have a large enough codebase, any class of error that is syntactically legal probably exists there.

Ignis

  • Seasoned Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 3242
Re: ITT we make fun of stupid stuff in GML
« Reply #129 on: November 03, 2013, 06:21:17 pm »

does gml use "mod" as the same thing as % in java (gives remainder of two numbers)
Logged
replays suck, use demos
demos are only good for setting traps, use soldier if you want to be aggressive and still have explosions
:whack:

Vindicator

  • Developer
  • ******
  • Karma: 84
  • Offline Offline
  • Posts: 2398
    • http://www.kylemoy.org/
Re: ITT we make fun of stupid stuff in GML
« Reply #130 on: November 03, 2013, 10:08:05 pm »

does gml use "mod" as the same thing as % in java (gives remainder of two numbers)

Yeah, that's what modulus does. It's just that GML and java take the sign of the dividend when doing the calculation so its results are different from other accepted implementations of modulo division (Python, C).
Logged

Ignis

  • Seasoned Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 3242
Re: ITT we make fun of stupid stuff in GML
« Reply #131 on: November 03, 2013, 10:39:52 pm »

I see, thanks.
Logged
replays suck, use demos
demos are only good for setting traps, use soldier if you want to be aggressive and still have explosions
:whack:

ajf

  • (Ex-?)Developer and forum/web admin
  • *****
  • Karma: 7
  • Offline Offline
  • Posts: 3415
  • she's never quite as dead as you think
Re: ITT we make fun of stupid stuff in GML
« Reply #132 on: December 24, 2013, 03:14:18 pm »

21:12 - (ajf): so guess what
21:13 - (ajf): if your extension defines a function in its manifest
21:13 - (ajf): which its GML lacks
21:13 - (ajf): ...GM will not moan
21:13 - (ajf): just silently fail
21:13 - (ajf): Thanks Overmars
« Last Edit: August 31, 2025, 05:45:06 pm by MedO »
Logged
did you know that spinning stars work like this???

I've seen things you people wouldn't believe. execute_strings on fire off the shoulder of Overmars. I watched object-beams glitter in the dark near the room_goto_fix. All those moments will be lost in time, like tears...in...rain. Time to die.

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: ITT we make fun of stupid stuff in GML
« Reply #133 on: December 30, 2013, 10:45:59 am »

21:12 - (ajf): so guess what
21:13 - (ajf): if your extension defines a function in its manifest
21:13 - (ajf): which its GML lacks
21:13 - (ajf): ...GM will not moan
21:13 - (ajf): just silently fail
21:13 - (ajf): Thanks Overmars
Manifest?
« Last Edit: August 31, 2025, 05:45:18 pm by MedO »
Logged

ajf

  • (Ex-?)Developer and forum/web admin
  • *****
  • Karma: 7
  • Offline Offline
  • Posts: 3415
  • she's never quite as dead as you think
Re: ITT we make fun of stupid stuff in GML
« Reply #134 on: December 30, 2013, 01:56:56 pm »

21:12 - (ajf): so guess what
21:13 - (ajf): if your extension defines a function in its manifest
21:13 - (ajf): which its GML lacks
21:13 - (ajf): ...GM will not moan
21:13 - (ajf): just silently fail
21:13 - (ajf): Thanks Overmars
Manifest?
I mean, in Extension Maker.
« Last Edit: August 31, 2025, 05:45:22 pm by MedO »
Logged
did you know that spinning stars work like this???

I've seen things you people wouldn't believe. execute_strings on fire off the shoulder of Overmars. I watched object-beams glitter in the dark near the room_goto_fix. All those moments will be lost in time, like tears...in...rain. Time to die.
Pages: 1 ... 7 8 [9] 10 11 ... 15
 

Page created in 0.035 seconds with 30 queries.