Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //val = current_time;
- // Take a string input.
- var current_check, result;
- result = false;
- for ( i = 1; i <= string_length( argument0 ); i += 1 )
- {
- current_check = string_char_at( argument0, i );
- if ( current_check == 'g' ) // Gamepad
- {
- i += 3;
- if (( controls.controller_useOld )&&( controls.controller_useReg ))
- {
- current_check = string_char_at( argument0, i-2 )+string_char_at( argument0, i-1 );
- switch ( current_check )
- {
- // Check
- case "x+":
- result = max( 0, joystick_xpos(1) );
- break;
- case "x-":
- result = abs(min( 0, joystick_xpos(1) ));
- break;
- case "y+":
- result = max( 0, joystick_ypos(1) );
- break;
- case "y-":
- result = abs(min( 0, joystick_ypos(1) ));
- break;
- case "u+":
- result = max( 0, joystick_xpos(2) );
- break;
- case "u-":
- result = abs(min( 0, joystick_xpos(2) ));
- break;
- case "v+":
- result = max( 0, joystick_ypos(2) );
- break;
- case "v-":
- result = abs(min( 0, joystick_ypos(2) ));
- break;
- default:
- if ( string_char_at( current_check, 1 ) == 'b' )
- {
- result = joystick_check_button( 1,real(string_char_at(current_check,2)+string_char_at( argument0, i )) );
- }
- break;
- }
- if ( result > controls.deadzone ) {
- global.gm_last_input = 2;
- return result;
- }
- ;
- }
- }
- else if ( current_check == 'x' ) // Xbox 360 controller
- {
- i += 3;
- if ( controls.controller_XB360_connected )
- {
- current_check = string_char_at( argument0, i-2 );
- switch ( current_check )
- {
- // Check
- case 'l':
- current_check = string_char_at( argument0, i-1 )+string_char_at( argument0, i );
- switch ( current_check )
- {
- case "x+":
- result = max( 0, SWiiX_XBoxLThumbX(0) );
- break;
- case "x-":
- result = abs(min( 0, SWiiX_XBoxLThumbX(0) ));
- break;
- case "y-":
- result = max( 0, SWiiX_XBoxLThumbY(0) );
- break;
- case "y+":
- result = abs(min( 0, SWiiX_XBoxLThumbY(0) ));
- break;
- case "b ":
- result = SWiiX_XBoxLTPress( 0 );
- break;
- }
- break;
- // Check
- case 'r':
- current_check = string_char_at( argument0, i-1 )+string_char_at( argument0, i );
- switch ( current_check )
- {
- case "x+":
- result = max( 0, SWiiX_XBoxRThumbX(0) );
- break;
- case "x-":
- result = abs(min( 0, SWiiX_XBoxRThumbX(0) ));
- break;
- case "y-":
- result = max( 0, SWiiX_XBoxRThumbY(0) );
- break;
- case "y+":
- result = abs(min( 0, SWiiX_XBoxRThumbY(0) ));
- break;
- case "b ":
- result = SWiiX_XBoxRTPress( 0 );
- break;
- }
- break;
- case 'b':
- current_check = string_char_at( argument0, i-1 )+string_char_at( argument0, i );
- //current_check = string_replace( current_check, " ", "" );
- switch ( current_check )
- {
- case "a_":
- result = SWiiX_XBoxAPress( 0 );
- break;
- case "b_":
- result = SWiiX_XBoxBPress( 0 );
- break;
- case "x_":
- result = SWiiX_XBoxXPress( 0 );
- break;
- case "y_":
- result = SWiiX_XBoxYPress( 0 );
- break;
- case "lb":
- result = SWiiX_XBoxLSPress( 0 );
- break;
- case "rb":
- result = SWiiX_XBoxRSPress( 0 );
- break;
- case "st":
- result = SWiiX_XBoxStartPress( 0 );
- break;
- case "en":
- result = SWiiX_XBoxBackPress( 0 );
- break;
- case "dl":
- result = SWiiX_XBoxDPadLeftPress( 0 );
- break;
- case "dr":
- result = SWiiX_XBoxDPadRightPress( 0 );
- break;
- case "du":
- result = SWiiX_XBoxDPadUpPress( 0 );
- break;
- case "dd":
- result = SWiiX_XBoxDPadDownPress( 0 );
- break;
- }
- break;
- default:
- ;
- } // End large check of first one
- if ( result > controls.deadzone ) {
- global.gm_last_input = 1;
- return result;
- }
- ;
- }
- }
- else if ( current_check == 'w' ) // Wii controller
- { // never implement this, ever
- i += 1;
- current_check = string_char_at( argument0, i );
- switch ( current_check )
- {
- // Check
- default:
- ;
- }
- }
- else
- {
- if ( keyboard_check_direct( ord( current_check ) ) )
- {
- global.gm_last_input = 0;
- return 1.0;
- }
- }
- }
- /*file = file_text_open_append("test.txt");
- file_text_write_real(file,current_time-val);
- file_text_close( file );
- */
- return 0.0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement