Page 1 of 10 123 ... LastLast
Results 1 to 25 of 241

Thread: Scripting Features & Improvements

  1. #1
    Join Date
    Feb 2015
    Location
    The Internet
    Posts
    1,309

    Scripting Features & Improvements

    Please post any issues, improvements and features you'd like to see with the new Scripting. Please note that Scripting is currently in beta so we'll be continuously working to improve it.

    Thank you.

  2. #2
    Make the Scripting window re-sizeable to view more of the text at once and make less of a need to scroll. I know this is not exactly the place, but this would be a good idea for the Notebook window as well.

  3. #3
    Color highlight for IDs, in-script search, auto completing for API functions... there is a lot of little things that can make the script editor a really cool feature, but at this stage it is better to copy paste to/from proper IDE.

    This is my first post here, hello and all, this new feature just made my mind to blow
    Last edited by srcanseco; 02-15-2016 at 05:18 PM. Reason: uops

  4. #4
    Allow users of mods that contains scrips to turn it off, so that we can enjoy both the scripted version and a non-scripted version without flodding the workshop with multiple files of basically the same mod.

  5. #5
    I know API is in current living status but if not planned, this kind of functions would be awesome:

    setCustomMesh
    setCustomDiffuse
    setCustomCollider
    setCustom{Anything}
    etc...

    Names are self-explanatory

  6. #6
    My most popular mod is "Draw It!", which is just a pictionary clone mod. But the ability for scripting now enables to more special challenges if people want a challenge mode.

    General idea I had that scripting could improve on is to have the ability control "ink" levels of drawing for a specific game mode.. So a player only has a limited amount of ink to draw the thing on the card.

  7. #7
    It would be cool to see a event for chat messages. For like custom commands and such.
    And we also need a sorta reload script button because having to rewind time and fast forwarding is the only way i found to actually reload the script.

  8. #8
    Examples with the provided API functions being put to use. As it stands, the Knowledge Base isn't doing it for me.

    Being that I've never used LUA script before, the syntax is a bit of a throw, but a few well-written and short examples would do wonders. Can't wait to get pluggin' away at this. Thanks for the update!

  9. #9
    Join Date
    Feb 2016
    Location
    Ontario
    Posts
    3
    I want to take a moment to discuss the current state of the scripting API and modding in general. In terms of modding, I think Tabletop Simulator is in a fantastic position! It's easy to work with and allows you to really create anything. The only downside is the lack of automation, which will (hopefully) be eradicated by scripts. Scripting has it's limitations for the moment (of course), but it will bring Tabletop Simulator to whole new levels. -- In the meantime it will need a large amount of work, as it's missing what I think are many key features.

    Yes I know scripting is new to Tabletop, and I don't expect everything to be in right now, but I really want to get a good understanding of what I can expect to be able to create in the coming months and even years

    Scripting Feature Suggestions:
    • Reference surfaces on custom models for buttons and displays (ultimate goal here is the ability to create tools such as the calculator)
    • Control the permissions of individual players color via scripts. (This would allow game creators to help enforce turn order, and act as a building block for future player-permission control)
    • User Interface Dialog Boxes (With callback functions that are provided an argument based on selection option)
    • Move and lock objects to Points via scripts

    Regardless, my big question is: Will I be able to produce traditional TCG systems similar to Pokémon Online CCG or Magic the Gathering Online?

    - This would also need:
    • Card Database support [Image + Script]
    • Deck Building which supports the above

  10. #10
    "Once your Lua code is written, save the game and reload it to run the script. You will have to save and reload the save each time you make changes to the scripts to get them to run."

    Erm. The first thing that comes to mind is "Save and reload game" button below the code editor window.
    Not to mention that saving/loading the blackjack game will spawn additional buttons and chips for player and throw chips up due to physics breaking it in the process. How can you change the script for this mod?

  11. #11
    Hey, I've spent some time playing with the scripting feature and I quite like it. I'd like to suggest a couple of new features that would be useful though.
    • More ways to access GameObject properties: As far as I can tell there's no easy way to access things like the type of a GameObject, nor specific properties like the value of a chip, the ID of a card, or the current face value of a die. The way around this that I've seen in the Blackjack example was to attach a script as a string to objects that the game spawns, then use getVarForGameObject to read off variables from that script. This is finicky and verbose, and also means that players are restricted to objects that are spawned in a specific way by the script. Functions such as getTypeForGameObject, getValueForGameObject etc. would be welcome.
    • onChatMessage listener: Pretty self explanatory. Would be useful to implement chat commands and the like.
    • Accessing properties of digital objects: It would be nice if there was a way to access stuff like the current value of a counter, the url of a tablet, or the current display on the clock. It would also be nice to have listeners that are fired when buttons are clicked on them. This could be used to create easy ways to arrange transactions between players by using a counter to specify the amount, or setting up chess timers with two clocks so that one starts as soon as the other stops.
    • Ability to edit notes: Having a automatically updated scoreboard on the bottom right of the screen would be fantastic.
    • Deck manipulation: Ways to access the cards in a deck (just some way to access the data attached to a card) would be nice, so things like sorting decks, cutting at specific points, moving cards of a specific type out etc. would be possible.
    • Custom context menu actions: Ability to specify custom actions in the context menu (that call a script function).
    • Drag listeners: Possibly a way to override the tooltip message the game gives you for selecting multiple objects, in the style of the dice sum when you select multiple dice or the total value when you select multiple chips. You could use a listener to override the default messages and make it easy to count up however many cards of the same type or whether a criterion has been fulfilled in the objects that you've just selected.

    I understand that the scripting is still a beta and so many of these features are likely planned and possibly implemented already (and I'm just a moron for not finding them), but as of currently it feels fairly incomplete. However, I'm still optimistic about the scripting possibilities that will be introduced.
    Last edited by MrInanimated; 02-16-2016 at 09:53 AM. Reason: Meant bottom right, not bottom left. Am idiot.

  12. #12
    Join Date
    Feb 2016
    Location
    Ontario
    Posts
    3
    Quote Originally Posted by MrInanimated View Post
    Ability to edit notes: Having a automatically updated scoreboard on the bottom left of the screen would be fantastic.
    Ooh that's a good one! A way to implement it might be be ability to adding a type of bbcode styled tag to your notes which is updated by a related variable in the Global Script.

    For example: typing [var:value] into your notes, would be replaced in the notes page with the current data in the variable named "value" -- whether it be text, numbers, or even tables.

  13. #13
    First post, lots of suggestions/criticism... this is gonna be good.

    I have quite a lot of experience with "garry's mod", an other sandbox game, thats main feature is pretty much its moddability, and Lua API. There are a lot of good practices there that I think the game could benefit from. I understand the current state of the API is the first stable release, just barely usable, but it could use quite a few heavy changes now, that could wastly improve its extensibility, and usability in the long term.

    Instead of passing GameObject references (handles) around for methods, Lua metatables could be utilized to make the scripting a lot more OOP like. In Lua, every object could have a metatable associated, that can handle otherwise nonstandard operations on objects, such as indexing, calling, aritmetic operations etc..

    The most important use of this is to tie GameObject handles together with methods that can be used on them. For example instead of writing "getPositionForGameObject(obj)" you could write "obj:getPosition()" with a little bit of metatable utilization.

    (For people not so familiar with the lua language, obj:getPosition(a,b,10) is eqvivalent to obj.getPosition(obj, a, b, 10). In this case, if obj has a metatable with an __index field, it can handle the indexing operation, despite GameObject not being a real table)

  14. #14
    Functions to query mouse and keyboard state.

    In Unity these are part of the Input class.

  15. #15
    It seems like "setRotationForGameObject" doesn't exist, contrary to the documentation. It gives an error "attempt to call a nil value". setRotationSmoothForGameObject works, and I would prefer to use it, but it often fails to rotate objects correctly when there's an obstruction. setPositionSmoothForGameObject also doesn't seem to actually do any smoothing? Objects just blink to the new position.

    I would like to see a lot more additional events. I can think of tons of useful ones-- onTurnEnd, onClick, onMouseover, onMove, onStop, onGrab, and onRelease. onClick and onMouseover would be especially useful if a toggle was added to make objects non-interactive and non-collidable. Then we could invent alternate ways to interact with objects by having them perform some scripted action when clicked.

    Adding the aforementioned toggles would also solve my issue with setRotationSmooth not working well when there's an obtruction-- I can just make it non-collidable while it's moving to its new position (or this could be added as a bool parameter to the smooth move/rotate functions).

    Another idea is to let scripts control the camera. Sometimes you might want to switch to a close-up (or cinematic) view while something is happening to make sure everyone can see it well. Per-player control would let us give a spectator view for everyone except the player, who has normal control over their own camera. And now I'm imagining functions to add buttons to the user interface, to let players toggle stuff like cinematic camera angles on and off, as well as provide actual game functionality.

  16. #16
    Please add a way to Roll dice! There currently appears to be no way to do this.

  17. #17
    When trying to make a self-contained object that would handle its own functions, came across an issue. I cannot get any coroutines to run if the script is upon a gameObject, though the same code will run fine on the global.

    This certainly could be intended behaviour, but if so, how is one to produce waits in the code?

    As far as requests, a set of hand-interfacing functions would be great, obtaining hand contents in particular.

  18. #18
    I posted this over at reddit, and a mod over there (Gikerl) redirected me to this thread, suggesting to post it here aswell! I'm a bit busy right now so I simply C&P what I wrote there:

    Hello everybody!

    First of all let me tell you that the scripting system is a dream coming true! Thank you so much. It is awesome. I already published a mod. Now.. while I was toying around with the new scripting system I ran into some problems. Mind that I have never ever even seen LUA code, so some of those things might be trivially easy for someone with experience. Please let me know if that's the case

    Save and Load

    I get that i have to load again after changing the script, but especially if the script is changing the board and there are some nasty bugs you want to track down it is always:

    Load (to reset the board), paste script, Save, Load again.

    I am sure I did this a few hundred times by now and it's getting really annoying. A script reload button would be the best but I'd also settle with hotkeys for quicksave/quickload, that'd be great!

    Missing or inaccurate documentation

    Now I'm sure this will get better over time, but some things are not working the way they should be or are not clear on what they do. For example setPositionSmoothForGameObject does the same as non-smooth in my trials. Not sure if I'm using it wrong or if it's buggy.

    Also it would be neat if the return values are more detailed. For example it would've saved me some time if I had know that all indices start at 1 instead of 0. (Is that some kind of LUA thing? I'm so used to starting at 0, it feels weird)

    Type checks/GameObject types

    I'm missing a feature to compare types of Objects. I've never done anything in LUA so maybe I just couldn't figure it out, but so far I wasn't able to get the type of an Object. I'd like to know if I have a card or a die in my scripting area. Do I really have to attach scripts to those objects with a field to tell me what kind of object it is? That is going to be a pain in the butt for huge mods.

    Last card of a deck or self-destructing decks

    This is by far the most annoying thing I've encountered so far. If you have a deck gameobject and want to deal out all cards to the players, you are stuck with the last card and have no means of dealing it or even getting its GUID or the game object itself. The moment (actually not exactly that moment, but a frame later, which makes it even worse), you deal the second to last card from the deck, that deck will vanish from existence, including its guid and the information about the last remaining card.

    My workarounds so far involved areas and checking what object is still there (bad if the deck is being moved around and timing issues because you have to wait for all other cards to move out of the area) and a dummy last card (since shuffle-lock is not a thing, you can imagine it's frustratingly easy to mess up).


    I hope that is some feedback the devs can work with and also if anyone has workarounds or solutions to any of my problems please let me know!

    Greetz,
    Cake

  19. #19
    I would also like the ability to control a timer from commands.

    So an example is I have 3 custom buttons with labels of "30s", "1 min" and "2 mins"

    so if I press the 1 min button it runs something like

    setTimer(timer_id, 60, y, 5)

    timer ID, time to set, display countdown to start [yes or no] countdown in seconds

    and the point of the "display countdown" is to have a "5,4,3,2,1..go" type message.

  20. #20
    • I agree for the need of a timer.
    • In addition to the API "print" and "printToAll" we need "printToColor(String player_color, String message)". This is important to automatically inform players of hidden roles or distribute knowledge only some players should know.
    • Probably in the mid-far future could we have a programmable GUI or at least a splash message of some kind.


    EDIT:
    P.S. For the programmable GUI I think adding menu points to the context menu would be a good and fitting start.
    Last edited by FragaholiC; 02-18-2016 at 12:01 PM.

  21. #21
    I imagine this will happen but really need something as well for dice as would be handy for custom di(c)e that don't use numbers to echo what the result means.


    if dieResult = 2 || dieResult = 5 then
    printtoAll('Left Hand was rolled')
    elseif dieResult = 1 || dieResult = 6 then
    printtoAll('Right Hand was rolled')
    ....

  22. #22
    Personally, I'd love to see some basic interoperability functions to be added between the lua scripting system and the javascript interpreter of the tablet's awesomium Javascript Interoperation Framework. This would allow us to create complex user interfaces or manuals that could perform actions out in the tabletop.

  23. #23
    Quote Originally Posted by Richy_s View Post
    When trying to make a self-contained object that would handle its own functions, came across an issue. I cannot get any coroutines to run if the script is upon a gameObject, though the same code will run fine on the global.
    Welp, I'm a moron. To anyone who finds this and has similar issue, know that startLuaCoroutine() does indeed need a function_owner reference. nil is left to refer to the global script, not as a same-file notation. This incidentally is why the code ran fine on the global.

    Time for me to get scripting!

  24. #24
    I would love to see printToColor(Color, String) so I can send messages to certain players only through the script.

    Edit: As a additional thing on that, I would love the abilit for an onMessage function so that if someone whispers someone else, I can get a notification. Would be useful in games where whispering isn't allowed

  25. #25
    Hey.

    Trying to make an automatic "keep the dice" area for King of Tokyo (but that could be used for a lot of games out there). What I want is:
    - Have a scripting area somewhere noticeable on the board (i.e. green plates underneath);
    - Holding a die and entering the script zone teleports the die to a set position, with the same rotation, and removes the player's "grasp" over it.
    - You can pick the saved die up without any problem.

    I tried that. I locked the die, hoping it would remove the player's interaction, but it doesn't. The player can't even remove it by himself, you need to unlock the die first manually, and it will just teleport where the player's hand is!
    If you think "Okay, let's let the player have the control over a locked die, why would that be a problem, it's locked!", well, it is a problem. When the player rolls something else, or even just shakes his hand a bit too strong, the locked die will rotate and roll too (but stay in position, because it is locked).

    So, that's an issue. You could probably add API functions to remove or give a player items on the board; add functions so that you can also lock Rotation (but that would just be a stupid workaround in my opinion); or... something else, I don't actually know.
    Still, using the API to manipulate dice is kinda low-level. You need to do a lot in order to get small results compared to cards or bags for now

Page 1 of 10 123 ... LastLast

Posting Permissions

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