Quantcast

Jump to content

» «
Photo

key press check

  • This topic is locked This topic is locked
1 reply to this topic
HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#1

Posted 14 July 2014 - 07:15 AM

I gave the option for the user to set one of the keys in the INI to 0 which will make only one key press needed to activate a portion of my script. For example, if Key1 > 0 and Key2 > 0 then the user will need to press both keys ingame to activate. However, if Key2 < 1 and Key1 is still > 0, then the user will only need to press Key1 to activate the script. How can I accomplish this technique??             

0AF0: read_int_from_ini_file "SAPDFR.ini" section "HELI" key "ForceSpawnKey1" store_to 13@
0AF0: read_int_from_ini_file "SAPDFR.ini" section "HELI" key "ForceSpawnKey2" store_to 14@
if
    13@ < 1
then
    if
        14@ < 1
    then
        13@ = 0x11
        14@ = 0x39
    else
        13@ = 0x0
    end
else   
    if
        14@ < 1
    then
        if
            13@ < 1
        then
            13@ = 0x11  // Ctrl
            14@ = 0x39  // 9
        else
            14@ = 0x0
        end
    end
end

while true
    wait 0
    if
        0256:   is_player_playing $PLAYER_CHAR
    then
        if and // Force heli to spawn and follow player for while
            0AB0:   is_key_pressed 13@ 
            0AB0:   is_key_pressed 14@ 
        then

HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#2

Posted 14 July 2014 - 05:58 PM

I solved my problem. I set the variable equal to the nonzero value.

0AF0: read_int_from_ini_file "SAPDFR.ini" section "HELI" key "ForceSpawnKey1" store_to 13@
0AF0: read_int_from_ini_file "SAPDFR.ini" section "HELI" key "ForceSpawnKey2" store_to 14@
if
    13@ < 1
then
    if
        14@ < 1
    then
        13@ = 0x11
        14@ = 0x39
    else
        0085: 13@ = 14@   //0x11  // 0x0
    end
else   
    if
        14@ < 1
    then
        if
            13@ < 1
        then
            13@ = 0x11  // Ctrl
            14@ = 0x39  // 9
        else
            0085: 14@ = 13@   //0x39   // 0x0
        end
    end
end

while true
    wait 0
    if
        0256:   is_player_playing $PLAYER_CHAR
    then
        if and // Force heli to spawn and follow player for while
            0AB0:   is_key_pressed 13@ 
            0AB0:   is_key_pressed 14@ 
        then




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users