| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Mr B
 
 
 
  Joined: 20 Mar 2003 Posts: 382
 
  | 
		
			
				 Posted: Mon Dec 17, 2007 2:44 pm    Post subject: "key is pressed(76)" bug | 
				     | 
			 
			
				
  | 
			 
			
				I am having an extremely odd problem with plotscripting.
 
 
The "key is pressed" command does not respond to key #76 -- numpad 5.  Toggling numlock makes no difference, and the key works in my word processor.
 
 
 	  | Code: | 	 		  if(key is pressed(76)) then (
 
   clear string(TEMP_MESSAGE)
 
   append number(TEMP_MESSAGE, 76)
 
   insert new message(TEMP_MESSAGE)
 
) | 	  
 
 
This is only one test I made for this.  Key 76 is just one in a number of keys I want to monitor, and I have a script that returned the key # of whichever key is being pressed.  I originally had the program display the # of whichever key was being pressed, but key #76 was the only one that was having problems.
 
 
I am uncertain as to which OHR version I am using (don't have it installed on the library computer).  It is no later than the last official release, and no earlier than this August.
 
 
I will download the latest and see if it works.[/code] | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Bob the Hamster OHRRPGCE Developer
 
 
  
  Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
  | 
		
			
				 Posted: Tue Dec 18, 2007 4:10 pm    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				So all other keys work with similar code?
 
 
Also, the OHR has no respect for numlock. :( | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Mr B
 
 
 
  Joined: 20 Mar 2003 Posts: 382
 
  | 
		
			
				 Posted: Thu Dec 20, 2007 12:58 pm    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				I used last Monday's nightly and the problem persisted.
 
 
Yeah; I haven't had this problem with any other key -- certainly not any of the other numpad keys.
 
 
I will start a new project and see if the problem happens with that.  Otherwise... | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Mr B
 
 
 
  Joined: 20 Mar 2003 Posts: 382
 
  | 
		
			
				 Posted: Thu Dec 20, 2007 4:08 pm    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				Okay: I ran a test and this is what I got.
 
 
 	  | Code: | 	 		  
 
include, plotscr.hsd
 
 
define script, begin
 
   1, test, 0
 
end
 
 
script, test, begin
 
   while(true) do (
 
      wait(1)
 
 
      if(key is pressed(76)) then ( game over )
 
      if(key is pressed(72)) then ( game over )
 
 
   )
 
end
 
 | 	  
 
 
Using a new file (with Monday's nightly) I used the above code as the "new game script".  Pressing key 72 (numpad 8 ) caused the game to end.  Pressing key 76 did nothing.[/code] | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		TMC On the Verge of Insanity
 
 
 
  Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
  | 
		
			
				 Posted: Sat Dec 22, 2007 6:52 pm    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				Numpad 5 works for me on this computer, as well as every other key (except those which are broken - I have 5+ spare PS/2 keyboards and should be using one of those instead). The OHR doesn't perform any mapping or anything between the FB scancode checking functions. Try out the gfx_sdl backend and see if that works. It uses totally different scancodes, which are mapped to the OHR native ones.
 
 
 	  | Code: | 	 		  include, plotscr.hsd
 
include, scancode.hsi
 
 
plotscript, main, begin
 
  showstringat (30, 0, 190)
 
  while (1) do (
 
    variable (i)
 
    for (i, 0, 93) do (
 
      if (keyval(i)) then ($30="", appendnumber(30,i), appendascii(30,32), append number (30, keyval(i)))
 
    )
 
    wait
 
  )
 
end | 	 
  _________________ "It is so great it is insanely great." | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |