Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //val = current_time;
  2.  
  3. // Take a string input.
  4. var current_check, result;
  5. result = false;
  6.  
  7. for ( i = 1; i <= string_length( argument0 ); i += 1 )
  8. {
  9.     current_check = string_char_at( argument0, i );
  10.     if ( current_check == 'g' ) // Gamepad
  11.     {
  12.         i += 3;
  13.         if (( controls.controller_useOld )&&( controls.controller_useReg ))
  14.         {
  15.             current_check = string_char_at( argument0, i-2 )+string_char_at( argument0, i-1 );
  16.             switch ( current_check )
  17.             {
  18.                 // Check
  19.                 case "x+":
  20.                     result = max( 0, joystick_xpos(1) );
  21.                     break;
  22.                 case "x-":
  23.                     result = abs(min( 0, joystick_xpos(1) ));
  24.                     break;
  25.                 case "y+":
  26.                     result = max( 0, joystick_ypos(1) );
  27.                     break;
  28.                 case "y-":
  29.                     result = abs(min( 0, joystick_ypos(1) ));
  30.                     break;
  31.                 case "u+":
  32.                     result = max( 0, joystick_xpos(2) );
  33.                     break;
  34.                 case "u-":
  35.                     result = abs(min( 0, joystick_xpos(2) ));
  36.                     break;
  37.                 case "v+":
  38.                     result = max( 0, joystick_ypos(2) );
  39.                     break;
  40.                 case "v-":
  41.                     result = abs(min( 0, joystick_ypos(2) ));
  42.                     break;
  43.                 default:
  44.                     if ( string_char_at( current_check, 1 ) == 'b' )
  45.                     {
  46.                         result = joystick_check_button( 1,real(string_char_at(current_check,2)+string_char_at( argument0, i )) );
  47.                     }
  48.                     break;
  49.             }
  50.             if ( result > controls.deadzone ) {
  51.                 global.gm_last_input = 2;
  52.                 return result;
  53.             }
  54.             ;
  55.         }
  56.     }
  57.     else if ( current_check == 'x' ) // Xbox 360 controller
  58.     {
  59.         i += 3;
  60.         if ( controls.controller_XB360_connected )
  61.         {
  62.             current_check = string_char_at( argument0, i-2 );
  63.             switch ( current_check )
  64.             {
  65.                 // Check
  66.                 case 'l':
  67.                     current_check = string_char_at( argument0, i-1 )+string_char_at( argument0, i );
  68.                     switch ( current_check )
  69.                     {
  70.                         case "x+":
  71.                             result = max( 0, SWiiX_XBoxLThumbX(0) );
  72.                             break;
  73.                         case "x-":
  74.                             result = abs(min( 0, SWiiX_XBoxLThumbX(0) ));
  75.                             break;
  76.                         case "y-":
  77.                             result = max( 0, SWiiX_XBoxLThumbY(0) );
  78.                             break;
  79.                         case "y+":
  80.                             result = abs(min( 0, SWiiX_XBoxLThumbY(0) ));
  81.                             break;
  82.                         case "b ":
  83.                             result = SWiiX_XBoxLTPress( 0 );
  84.                             break;
  85.                     }
  86.                     break;
  87.                 // Check
  88.                 case 'r':
  89.                     current_check = string_char_at( argument0, i-1 )+string_char_at( argument0, i );
  90.                     switch ( current_check )
  91.                     {
  92.                         case "x+":
  93.                             result = max( 0, SWiiX_XBoxRThumbX(0) );
  94.                             break;
  95.                         case "x-":
  96.                             result = abs(min( 0, SWiiX_XBoxRThumbX(0) ));
  97.                             break;
  98.                         case "y-":
  99.                             result = max( 0, SWiiX_XBoxRThumbY(0) );
  100.                             break;
  101.                         case "y+":
  102.                             result = abs(min( 0, SWiiX_XBoxRThumbY(0) ));
  103.                             break;
  104.                         case "b ":
  105.                             result = SWiiX_XBoxRTPress( 0 );
  106.                             break;
  107.                     }
  108.                     break;
  109.                 case 'b':
  110.                     current_check = string_char_at( argument0, i-1 )+string_char_at( argument0, i );
  111.                     //current_check = string_replace( current_check, " ", "" );
  112.                     switch ( current_check )
  113.                     {
  114.                         case "a_":
  115.                             result = SWiiX_XBoxAPress( 0 );
  116.                             break;
  117.                         case "b_":
  118.                             result = SWiiX_XBoxBPress( 0 );
  119.                             break;
  120.                         case "x_":
  121.                             result = SWiiX_XBoxXPress( 0 );
  122.                             break;
  123.                         case "y_":
  124.                             result = SWiiX_XBoxYPress( 0 );
  125.                             break;
  126.                         case "lb":
  127.                             result = SWiiX_XBoxLSPress( 0 );
  128.                             break;
  129.                         case "rb":
  130.                             result = SWiiX_XBoxRSPress( 0 );
  131.                             break;
  132.                         case "st":
  133.                             result = SWiiX_XBoxStartPress( 0 );
  134.                             break;
  135.                         case "en":
  136.                             result = SWiiX_XBoxBackPress( 0 );
  137.                             break;
  138.                         case "dl":
  139.                             result = SWiiX_XBoxDPadLeftPress( 0 );
  140.                             break;
  141.                         case "dr":
  142.                             result = SWiiX_XBoxDPadRightPress( 0 );
  143.                             break;
  144.                         case "du":
  145.                             result = SWiiX_XBoxDPadUpPress( 0 );
  146.                             break;
  147.                         case "dd":
  148.                             result = SWiiX_XBoxDPadDownPress( 0 );
  149.                             break;
  150.                     }
  151.                     break;
  152.                 default:
  153.                     ;
  154.             } // End large check of first one
  155.             if ( result > controls.deadzone ) {
  156.                 global.gm_last_input = 1;
  157.                 return result;
  158.             }
  159.             ;
  160.         }
  161.     }
  162.     else if ( current_check == 'w' ) // Wii controller
  163.     {   // never implement this, ever
  164.         i += 1;
  165.         current_check = string_char_at( argument0, i );
  166.         switch ( current_check )
  167.         {
  168.             // Check
  169.             default:
  170.                 ;
  171.         }
  172.     }
  173.     else
  174.     {
  175.         if ( keyboard_check_direct( ord( current_check ) ) )
  176.         {
  177.             global.gm_last_input = 0;
  178.             return 1.0;
  179.         }
  180.     }
  181. }
  182.  
  183. /*file = file_text_open_append("test.txt");
  184. file_text_write_real(file,current_time-val);
  185. file_text_close( file );
  186. */
  187. return 0.0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement