Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    572

    way the break dont work?

    way the break dont work?
    27 is "Esc"

    for i = 1, 1000000 do
    Label.SetText("Label1", i);
    if e_Key == 27 then
    break;
    end
    end

  2. #2
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    There's nothing inside that loop to check for the key. It just checks what the value of e_Key is.

    Assuming you have that in an On Key event, that loop is going to happen every time you press a key, because the whole loop is inside the event -- the loop doesn't start until the key is pressed. It will count up to 1000000 for every key except the Esc key, which will just count up to 1.

    If you wanted to check a key press from within a loop like that, you'd need to use a DLL or something to check the current key state.

    Another way to do this would be to use a timer to do the counting, and make your script in the On Key event set a variable that affects the counting in the On Timer event, or just stops the timer, etc.
    --[[ Indigo Rose Software Developer ]]

  3. #3
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Code:
    for n=1, 10000 do
    	if System.IsKeyDown(27) then
    		break
    	end
    	Application.Sleep(1)
    end
    Last edited by Worm; 09-28-2006 at 10:00 AM.

  4. #4
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    ...or use System.IsKeyDown. Heh.

    I thought we had something like that, but I couldn't remember the name and didn't find it in the help file. Doh.

    Thanks Worm.
    --[[ Indigo Rose Software Developer ]]

  5. #5
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    I got your back Lorne

    I'd used User32.dll's GetKeyState in the past until someone pointed System.IsKeyDown out to me. Wish I could give credit where its due, but who that was escapes me.

    In the limited testing I've done, it's important to have the Application.Sleep or the key never is processed.

Similar Threads

  1. Does Autorun MAX Work on Macs?
    By Adam in forum Autorun MAX! 2.1 FAQ
    Replies: 0
    Last Post: 08-29-2006, 12:50 PM
  2. Having problems getting installer frontend to work
    By Scott Lawrence in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 07-24-2006, 03:49 PM
  3. AVI files does not work when I use Web/Email Executable
    By ricardohdezsv in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 06-08-2006, 02:07 PM
  4. Using WMV codec - will it work?
    By David Delaney in forum AutoPlay Media Studio 5.0
    Replies: 10
    Last Post: 06-08-2004, 02:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts