Variables not being set correctly

This is a discussion on Variables not being set correctly within the C++ Programming forums, part of the General Programming Boards category; Ok, so I'm making a game. Now I've run into a problem, I'm trying to set an integer variable selected[1] ...

  1. #1
    Semi n00b Mithoric's Avatar
    Join Date
    Jun 2003
    Posts
    293

    Variables not being set correctly

    Ok, so I'm making a game.
    Now I've run into a problem, I'm trying to set an integer variable selected[1] = 1; but it is returned as 3?

    There is absolutely nothing wrong with my code. Well that is what I'd say but there obviously is if I'm getting the wrong value assigned to it.

    I'd have put this in the game programming forum but it's not game specific.

    Line 757 is where the if statement where the variable is set resides.
    Attached Files Attached Files
    Last edited by Mithoric; 09-07-2003 at 11:23 PM.

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    well i tried to look through your code but i game up fast, all I can say is you are using way way way way too many global variables.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    22
    don't use inverted commas (or whatever they're called lol) when you do this: keys['1']

    Just do this: keys[1]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data set
    By MarkZWEERS in forum C++ Programming
    Replies: 2
    Last Post: 02-07-2009, 03:24 AM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 01:39 PM
  3. global variables
    By shadovv in forum C++ Programming
    Replies: 7
    Last Post: 10-24-2005, 02:21 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM
  5. LISP (DrScheme) any one?
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-31-2004, 11:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21