Why it doesnt work?

  • ssccsscc
    9th Jun 2016 Member 0 Permalink

    Its must write "works" when I press Ctrl+J, but nothing.


    function toggle(a,b,c,d)
    tpt.log(a,b,c,d)
    if (c==64) and (a=="j") and (d==1) then
    tpt.log("works")
    end
    end
    tpt.register_keypress(toggle)


    And when i press ctr+j "tpt.log(a,b,c,d)" printing strange things:

    When i press "j" without "ctrl" variable "a" is "j" but when i press "Ctrl+j" its " ".
    This script worked 1 month ago.

    Edited 3 times by ssccsscc. Last: 9th Jun 2016
  • jacob2
    9th Jun 2016 Member 0 Permalink
    Which version of TPT are you using? Official 91.3? Latest version of my mod? 91.0 made a change which made keyfuntions better but accidentally broke some scripts. I should have fixed this for the latest version of my mod.

    I can do some testing when I am at my computer.
  • ssccsscc
    10th Jun 2016 Member 0 Permalink

    I using official 91.3

  • jacob1
    12th Jun 2016 Developer 0 Permalink
    Fixed it in https://github.com/simtr/The-Powder-Toy/commit/2a541bd2f5cbb2e9eacb01c8200649961b299c8b

    You can test it in this snapshot: https://cracker.starcatcher.us/TPT/

    Basically SDL was being annoying and sending ^J instead of "j". ^J is a newline, which is also why the console logs looked weird.