Results 1 to 6 of 6

Thread: Nice new AssetBundle scripting!

  1. #1

    Nice new AssetBundle scripting!

    So.
    Since in-game the Looping and Trigger Effects of AssetBundles are labelled starting with 1.
    And Lua itself is also 1-based, for the purposes of table arrays and math.random (the latter being more relevant here).

    Why is obj.AssetBundle.playTriggerEffect (and I assume the rest of the AssetBundles section) 0-based?
    Ya done goofed... You bunch of sillies.

  2. #2
    Join Date
    May 2016
    Posts
    1,072
    Button indexes and notepad indexes are also like this. It is a little bit of a surprise learning curve.

    Especially on this one, because the Trigger was actually labeled as "1" in the context menu haha fortunately I'd done enough scripting by this point to guess at the solution pretty quickly

  3. #3
    Join Date
    Jan 2014
    Posts
    998
    To keep things consistent with the previous indexes I made it zero based. Not sure why they were besides being less error prone since of course c# is zero based indexes.

  4. #4
    Quote Originally Posted by Knil View Post
    ... since of course c# is zero based indexes.
    This was my assumption. I'm just starting to get into Lua (specifically for TTS) and as someone who's been programming for going on 8 years in a few different languages, suddenly finding myself in 1-based indexing land when every other language I've ever seen is 0-based has thrown me for quite a loop, haha.

  5. #5
    Join Date
    Jan 2014
    Posts
    998
    Ya can't say I'm a fan of 1 based indexes in Lua, I can't even think of another language that does this...

  6. #6
    Join Date
    May 2016
    Posts
    1,072
    None that I've ever heard of. It is just one of Lua's many fun little quirks.

    But for this kind of stuff, Lua is still my favorite language to script in. So simple compared to every language... at least until you want it to do something it doesn't normally do (like quats) lol

Posting Permissions

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