Windows Script Template ?

Discussion in 'GameMaker Studio 2 Community Tech Support' started by jackquake, Aug 13, 2019.

  1. jackquake

    jackquake Member

    Joined:
    Aug 17, 2016
    Posts:
    81
    I understand that you can click on File --> Preferences --> Object Editor to define a template for the object events, which is helpful.

    Is there a way to also do the same for scripts? Perhaps I've missed it, but it would be very helpful to have something like the below to appear as the default when a script is created for all of the JSDoc documentation tags.

    Code:
    ///@func Function(input1, input2, etc);
    ///@desc Insert Description Here
    ///@param input1
    ///@param input2
    
    As a workaround, maybe I can add a "code snippet" to do the same--I haven't tried though.

    What do you guys do?
     
    Last edited: Aug 15, 2019
    wipeout2185 likes this.
  2. jackquake

    jackquake Member

    Joined:
    Aug 17, 2016
    Posts:
    81
    After playing around with code snippets a bit, I got one to work for the above. In case you're interested, here it is.

    Link to further understand code snippets.
    Link to JSDoc for Scripts.

    Here is the snippet:
    Code:
    S - Script Doc:///@func |Function(input1, input2, etc)|;$///@desc Insert Description Here$///@param input1$///@param input2
    
    Copy/Paste the above in a text file called snippets.txt (assuming you haven't already created one). Locate the file according to your OS (not sure about Linux):
    Windows: %ProgramData%\GameMakerStudio2\User\
    macOS: /Users/Shared/GameMakerStudio2/User/

    Restart Gamemaker.

    Now, open a new script, press F4 key and choose S. Voila! Your script will now have the JSDoc comments.

    Hopefully, this helps. With as many scripts as we write though, I'm requesting that YoYo Games puts a template feature in the preferences someday (just like there is for objects), as it would be a tremendous time saver for writing documented scripts.
     
    IndianaBones likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice