Results 1 to 20 of 20

Thread: [RELEASE] TTS API autocompletion and tooltips for Notepad++

  1. #1
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16

    TTS API Autocomplete, tooltips and Save & Play for Notepad++

    Latest Releases:
    Description Version Game Version
    Save & Play 1.0.1 Any
    Autocomplete 1.8.0 9.9


    Autocomplete:

    Description:
    In an attempt to improve scripting in Tabletop Simulator for those who use Notepad++, I created a file that adds support for it to autocomplete functions from the API as you type them and also give tooltips about their parameters and usage.

    The tooltips were taken from the API's Knowledge base page, some directly and others edited by me to ensure consistence and readability.
    For functions which have the same name across different classes (e.g setValue( )), multiple overloads are offered, each one specifying which class they belong to.

    Installation:
    1. Download the file from here and put it into {Notepad++ installation path}/plugins/APIs

    Changelog (1.8.0):

    • Added all functions introduced from v9.6 to v9.9.

    Older Changelogs:



    Changelog (1.7.0):

    • Added all functions introduced in v9.5.
    • Added bool debug to Physics.cast( ).

    Changelog (1.6.0):

    • Added getSpectators( ).
    • Fixed missing functions from the Player class.

    Changelog (1.5.0):

    • Added all functions introduced in v9.3.
    • Changed from Table to Vector and Color in the appropriate functions.
    • Fixed some descriptions using past-tense functions (e.g. onDropped( )).

    Changelog (1.4.0):

    • Added color, font_color and alpha to button functions.
    • Fixed missing scale property in createButton( ).

    Changelog (1.3.0):

    • Fixed missing prototype for getPointerRotation( ).
    • Added scale parameter to createButton( ) and editButton( ).

    Changelog (1.2.0):

    • Fixed onPlayerChangedColor( ) to onPlayerChangeColor( ).
    • Added getStateId( ).
    • Added onObjectLeaveContainer(Object Container, Object LeaveObject).

    Changelog (1.1.1):

    • Fixed wrong prototype for broadcastToColor( ).




    Save & Play:

    Description:
    This allows Notepad++ to send scripts to the Tabletop Simulator in-game editor at the press of a button. Currently, you cannot import scripts from the game automatically.

    Prerequisites:
    This requires Python Script (a Notepad++ plugin that allows other plugins to be written using python) to work.
    1. Go to Plugins > Plugin Manager > Show Plugin Manager
    2. Find Python Script in the list, check it and then click Install. Let the program restart.

    Installation:
    1. Download the file from here and put it into {Notepad++ installation path}/plugins/PythonScript/scripts
    2. Go to Plugins > Python Script > Configuration
    3. Select Machine Scripts and click on Save and Play.py then click the Add button just above "Toolbar icons".
    4. Restart Notepad++ and you should see a new button on the program's toolbar with the python icon, this is the Save & Play button.

    Usage:
    1. Open Tabletop Simulator.
    2. Create a new file in Notepad++ and save it as "[guid] any_name_you_want.lua", without quotes, where guid is either the guid of the component you want this script to go into or -1 if this is the Global script. Make sure to surround it in brackets.
    3. Write some code in the file.
    4. Click the Save & Play button in Notepad++.
    5. If your scripts got transferred to TTS, congratulations and happy scripting. If not, make sure you followed all the steps correctly.

    Changelog (1.1.0):

    • Files can now have any name, as long as they have the target object guid surrounded by brackets. This makes it easier to maintain multiple versios of the same file.
    Last edited by JotaFaD; 10-24-2017 at 02:00 PM.

  2. #2
    That's actually really useful! Thanks for sharing.

  3. #3
    Join Date
    May 2016
    Posts
    1,072
    haha I had just mentioned this would be ideal. Thank you very much for sharing it, this will be amazing for those who prefer Notepad ++

  4. #4
    Join Date
    Sep 2016
    Posts
    216
    Nice! Now if only there's a way to deploy the scripts directly to the game ala Save & Run

  5. #5
    Join Date
    May 2016
    Posts
    1,072
    Agreed, that would be ideal.

    I like Atom, but the auto-complete trying to complete when it shouldn't and not completing variable names gets really old sometimes. And from what I can tell, that is just an issue with how their autocomplete modules interact with lua in general

  6. #6
    Could you update this please?

  7. #7
    I just noticed that the tooltip for broadcastToColor() misses a parameter.

    Right now it displays: "bool broadcastToColor(string message, {float r, float g, float b})"
    It should display: "bool broadcastToColor(string message, string player_color, {float r, float g, float b})"

  8. #8
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16
    Quote Originally Posted by Mark View Post
    I just noticed that the tooltip for broadcastToColor() misses a parameter.

    Right now it displays: "bool broadcastToColor(string message, {float r, float g, float b})"
    It should display: "bool broadcastToColor(string message, string player_color, {float r, float g, float b})"
    Thanks for the report Mark, it's now fixed.

  9. #9
    I found another small error. The auto-completion recognises the old onPlayerChangedColor() function but not the new onPlayerChangeColor() function. The old past tense version was deprecated.

  10. #10
    I got your file and went through it quick. I found a mistake and updated locally to v9.0

    getPointerPosition is defined twice in the file. The 2nd one should be getPointerRotation.

    In 8.9 they added the scale parameter to createButton and editButton. I won't post my copy here though without permission since it is your work. I just fixed some stuff up here.

  11. #11
    Any chance of an update for 9.3?

  12. #12
    This is just autocomplete, no option for integrated save/load scripts? Dunno if it's this or I just can't find the option.

  13. #13
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16
    Quote Originally Posted by dzikakulka View Post
    This is just autocomplete, no option for integrated save/load scripts? Dunno if it's this or I just can't find the option.
    Just autocomplete.

  14. #14
    If you can get it to automatically load and save the current game (like the Atom plugin does) then I'd definitely think about making the switch; Atom drives me bananas (the autocomplete from the tts module is irritating, and Atom's search/replace is wonky as hell).
    A further feature request would be to keep a buffer of all recent saves; because of the ropey interactions between saving in tts and saving in the editor it's really easy (in Atom at least) to nuke all your work. I'm now in the habit of ctrl-a, ctrl-c whenever I move from one to the other, just in case.

  15. #15
    Quote Originally Posted by onelivesleft View Post
    If you can get it to automatically load and save the current game (like the Atom plugin does) then I'd definitely think about making the switch; Atom drives me bananas (the autocomplete from the tts module is irritating, and Atom's search/replace is wonky as hell).
    A further feature request would be to keep a buffer of all recent saves; because of the ropey interactions between saving in tts and saving in the editor it's really easy (in Atom at least) to nuke all your work. I'm now in the habit of ctrl-a, ctrl-c whenever I move from one to the other, just in case.
    This is why I don't use Atom because I don't trust it to keep backups of my code. Ctrl+A Ctrl+C, switch to TTS and click in the code window, Ctrl+A Ctrl+V. Then click Save & Play. It's not hard for me.
    Then when I create a new iteration of my code I save it under a new filename, so that if something goes wrong I can always revert or pull things from older versions.

  16. #16
    Next time Atom pisses me off I'll probably give this a shot

  17. #17
    Join Date
    Jan 2014
    Posts
    986
    Nice work on this.

  18. #18
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16
    Quote Originally Posted by Knil View Post
    Nice work on this.
    Thanks Knil. Great work on the game.

  19. #19
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16
    Updated to v9.5.

  20. #20
    Join Date
    Sep 2016
    Posts
    216
    Whoa you can use Save & Play now?? Awesome!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •