TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 17 of 17

Thread: New (old) Squirrel scripts

  1. #1
    Member
    Registered: Aug 2001
    Location: Virginia, USA

    New (old) Squirrel scripts

    https://github.com/whoopdedo/tnhscript/

    tnhScript is being rewritten in Squirrel. This time as GPL code to encourage reuse and modification. I've started with the most frequently used scripts: TrapMoveRelative, TrapFadeOut, TrapCamAttach, and TrapFreezePlayer.

    I won't be rewriting all of the old scripts either because they're not needed (DoorFrobInert can just use the "Block Frob" property.) or aren't possible with squirrel.osm (TrackAttach uses hooks.)

    A few observations on Squirrel scripts. The first question I had was, "why an OSM?" You're wrapping an interpreted API over a thin API wrapper of a few select engine features. I would have hoped that any new scripting interface would replace the existing and limited script services. Integrating the VM in the engine gives you better control of the script lifecycle, access to more advanced features such as property/link/etc change notification and creating custom messages. And of course it would be much faster. Putting it in an OSM I felt was a hack when I did it with Lua. (And even before that with Python.)

    But I was curious to see how squirrel.osm solved problems I had already experienced. Most of the porting of scripts has gone smoothly. Just a few bumps related to getting up to speed with the Squirrel language. But as far as creating scripts and message handlers its all been uneventful. And the way it deals with non-standard names is interesting, though I think slightly unnecessary. (The language does allow you to create non-alphanumeric names. You just have to use [] instead of dot notation.)

    I am experiencing frequent crashes. Specifically, if a script aborts on an error I need to exit Dromed or else the next time Squirrel tries to load it will hang.

    The differences between Squirrel and my own modules was filled in using a few custom methods. In particular, the design note param accessors. Typing 'X in userparams() ? userparams().X : default' too many times necessitated that. I'd still like to see that use case implemented in the API. If not the full type conversion of my libraries, at least something like userparams(key,def=null) to retrieve a name if it exists or return a default fallback.

    And I can't get DarkGame.FadeIn to work. I'm not sure if I'm not using it correctly, but it should set the screen black then gradually transition to normal, the opposite of 'FadeToBlack'. Am I missing something?

  2. #2
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    \O/ Thank you, Tom. I wish I could be of some help with your questions.

  3. #3
    Member
    Registered: May 2006
    Location: Russia
    What about CommandControl?

  4. #4
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Quote Originally Posted by Telliamed View Post
    But as far as creating scripts and message handlers it's all been uneventful.
    Badum-tsh.

  5. #5
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Quote Originally Posted by Telliamed View Post
    And I can't get DarkGame.FadeIn to work. I'm not sure if I'm not using it correctly, but it should set the screen black then gradually transition to normal, the opposite of 'FadeToBlack'. Am I missing something?
    This is just a guess, but is it possible that DarkGame.FadeIn doesn't set the screen to black, but just fades to normal from wherever it starts?

  6. #6
    Member
    Registered: Jan 2012
    Location: Gèrmany
    Quote Originally Posted by LarryG View Post
    This is just a guess, but is it possible that DarkGame.FadeIn doesn't set the screen to black, but just fades to normal from wherever it starts?
    Sadly no. I switched so many switches while beeing blind.

    I wonder why it also wasn't documented in the script services from 1.24 but well the function exists..

  7. #7
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    The HRESULT value is -2147467259, but I don't know if the value means anything, or whether we can only go by the documentation's statement that negative means "failure".

  8. #8
    Member
    Registered: Aug 2001
    Location: Virginia, USA
    Quote Originally Posted by Zontik View Post
    What about CommandControl?
    What about it? Still of limited use. Though it does show up twice in my FM survey. (The_Farm and Godbreaker). So I've added it, all 5 lines.

    Oh, in case you were wondering, the top 10 custom scripts are
    1. NVRelayTrap
    2. NVPhantomTrap
    3. IntrinsicPlaque
    4. InvSchema
    5. NVMetaTrap
    6. NVItemGiver
    7. NVFrobToggle
    8. TrapRenderFlash
    9. TrapMetaProp
    10. TrapMoveRelative


    Out of 87 FMs. Which sounds low. Did I missed a folder when scanning?

    Quote Originally Posted by R Soul View Post
    The HRESULT value is -2147467259, but I don't know if the value means anything, or whether we can only go by the documentation's statement that negative means "failure".
    Or 0x80004005 which is E_FAIL.
    But it isn't E_NOTIMPL which was what I almost expected.

    Quote Originally Posted by ZylonBane View Post
    Badum-tsh.

  9. #9
    Member
    Registered: May 2006
    Location: Russia
    What about it?
    I meant, doesn't it use hooks?
    the top 10 custom scripts are
    I'm surprised. Nobody uses OnScreenText???

  10. #10
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    I use it extensively for all the subtitles in DCE (which was begun before NewDark supported them). It is more flexible than NV's comparable script.

  11. #11
    Member
    Registered: Aug 2001
    Location: Virginia, USA
    Quote Originally Posted by Zontik View Post
    I meant, doesn't it use hooks?
    No. It's the least interesting script I've ever made. All it does is run one of the commands that are usually only available in Dromed. The only useful command that worked in Thief2.exe was `movie`. Are you thinking of a different script?

    OnScreenText is 24th, NVOnScreenText is 14th. But as I said I left out a folder with twice as many missions (though some are duplicates of already scanned FMs) so there's a lot missing.

  12. #12
    Member
    Registered: May 2006
    Location: Russia
    Are you thinking of a different script?
    I doubt.
    I've used it for appearing inventory items in player's "hand" by trigger. And in some other cases, can't remember right now. Probably I've used it to change default map colors (and to save them after reloading). Some command works in game as well. Don't think it's absolutely out of use, it's very powerful. Can't believe you didn't know.
    BTW, it's a good case to thank you for all those scripts.

  13. #13
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    I use it to force inventory selection also. I wanted to use it in Waterfront Racket to play a movie, but since some players have problems with movies playing in general (due to the codec randomly failing to load in NewDark) I decided to go with in-game cutscenes instead.

  14. #14
    Member
    Registered: May 2006
    Location: Russia
    Yandros, which codec do you use?

  15. #15
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    It's not the one I'm using to encode the videos, it's the playback resources that Thief 2 fails to load sometimes when it starts up - sorry if I used the wrong word there. It's not just me, players have mentioned it in numerous threads in the FM forum as well. Every time I launch T2 to play, I start the Credits movie to make sure it plays before going further, and if it fails I exit and restart. I've found that sometimes having a web browser open causes it to fail always until I close the browser, as if the browser has some video resource locked that causes T2 not to be able to load it.

  16. #16
    Member
    Registered: May 2006
    Location: Russia
    Interesting. I had the same problem sometimes while using Old Dark (mostly after using certain video soft before starting Thief), but with New Dark the problem has completely gone.
    I have got some ingame movies in my current project, unfortunately they can't be reproduced on game engine. And they are very important.
    I use NVCutsceneTrap script to start them. No problems detected, either on my working PC (Win XP) nor testing netbook (Win 7). The old good Indeo, just because it seems Indeo has less chances to be rejected by player's system. Though, its quality is too low...

  17. #17
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    Yes, I think I used XVid to encode the movies for Racket. We still had movies, but only used briefing and after-mission cutscene movies, not mid-mission movies.

Posting Permissions

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