--SOLVED, SOLUTION IN MY FINAL POST--
Hey everyone, I think I've finally found something more illogical than the 20 character password I needed to register for this forum.
Anyway I was making great progress in my game, liking the fact that programming languages were logical until... they were not.
So here's a very simple riddle for you. No labyrinthine code segments here.
if(keyboard_check_pressed(ord("1")))
{
UsedItem=global.Inventory1
global.Inventory1=""
}
It does not work. The UsedItem is receiving nothing, though the global.Inventory1 is.
But here's what does work. Note the miniscule and completely inconsequential changes.
if(keyboard_check_pressed(ord("0")))
{
UsedItem=global.Inventory1
global.Inventory1=""
}
if(keyboard_check_pressed(ord("1")))
{
UsedItem=global.Inventory2
global.Inventory2=""
}
So I'm trying to wrap my head around this. Apparently there is some bizarre and almost ludicrous interaction between the use of 'ord 1' and 'global inventory 1'. What could it be? Are programming languages really logical?
I've monitored and debugged this from every angle. All variables are being drawn on my screen. I've isolated every single statement in here. There is no conceivable reason this should not work. Of course as a workaround I could just change it to 'ord 0' and be done with it, however this is part of a user input from a sequence of numbers, and going from '0' to '2' would be a little odd.
Hey everyone, I think I've finally found something more illogical than the 20 character password I needed to register for this forum.
Anyway I was making great progress in my game, liking the fact that programming languages were logical until... they were not.
So here's a very simple riddle for you. No labyrinthine code segments here.
if(keyboard_check_pressed(ord("1")))
{
UsedItem=global.Inventory1
global.Inventory1=""
}
It does not work. The UsedItem is receiving nothing, though the global.Inventory1 is.
But here's what does work. Note the miniscule and completely inconsequential changes.
if(keyboard_check_pressed(ord("0")))
{
UsedItem=global.Inventory1
global.Inventory1=""
}
if(keyboard_check_pressed(ord("1")))
{
UsedItem=global.Inventory2
global.Inventory2=""
}
So I'm trying to wrap my head around this. Apparently there is some bizarre and almost ludicrous interaction between the use of 'ord 1' and 'global inventory 1'. What could it be? Are programming languages really logical?
I've monitored and debugged this from every angle. All variables are being drawn on my screen. I've isolated every single statement in here. There is no conceivable reason this should not work. Of course as a workaround I could just change it to 'ord 0' and be done with it, however this is part of a user input from a sequence of numbers, and going from '0' to '2' would be a little odd.
Last edited: