New R95 Lua Functions!

Discussion in 'Lua Discussions' started by DavidDC, Oct 27, 2021.

Thread Status:
Not open for further replies.
  1. DavidDC

    DavidDC Programmer Moderator SOTA Developer

    Messages:
    1,532
    Likes Received:
    3,236
    Trophy Points:
    113
    Gender:
    Male
    Hey everybody!

    Another great release kicking in with tons of stuff for you to play with! But this time we included a major Lua overhaul which will now use the actual unity UI instead of the old OnGUI. This new UI system is way faster and better then the old for many reasons. The old OnGUI functions will now be deprecated and removed in the futur.

    A long list of functions has been added to give you the functionality that we have with Unity.
    That list can be found on this API document.

    Since this will bring some new stuff that you might have not seen before while programming with Lua, i'm also giving you guys a detailed example of how to use some of this new functions. You should be able to create your own things afterward.

    Download the Lua Demo
    NOTE: I forgot to add the parentKind in the demo as variable to save along with parentID. It's really important if you want to assign the id to the object kind you are trying to access.

    If you have any question or see any bugs, please report!
     
    Last edited: Nov 2, 2021
    Wilfred, Elgarion, Winfield and 7 others like this.
  2. DavidDC

    DavidDC Programmer Moderator SOTA Developer

    Messages:
    1,532
    Likes Received:
    3,236
    Trophy Points:
    113
    Gender:
    Male
    Added a few more function yesterday after hearing some players demand. Updated API Doc with the new function and created this small script. Enjoy :)

    Code:
    function ShroudOnStart()
        local currentDeck = ShroudCurrentDeck();
     
        ConsoleLog(string.format("Current Deck ID: %s Name: %s", currentDeck.id, currentDeck.name));
     
        local cardList = ShroudGetDeckCardList("Blades");
     
        if cardList then
            for i,v in pairs(cardList) do
                ConsoleLog(string.format("Deck Card ID: %s Name: %s Qty: %s", v.id, v.name, v.quantity));
            end
        end
     
        local deckList = ShroudDeckList();
     
        if deckList then
            for i,v in pairs(deckList) do
                ConsoleLog(string.format("Deck Name: %s Qty Cards: %s", v.name, v.quantity));
            end
        end
     
        local emoteList = ShroudEmoteList()
     
        if emoteList then
            for i,v in pairs(emoteList) do
                ConsoleLog(string.format("Emote Name: %s ", v));
            end
        end
     
        ShroudPlayEmote("Akimbo");
    end

    Edit: forgot to mention i did this script super fast, its in ShroudOnStart, and lua might load before your player do and wont show stats. Make sure to do /lua reload once you are in the game to see it!
     
    Last edited: Oct 29, 2021
  3. DavidDC

    DavidDC Programmer Moderator SOTA Developer

    Messages:
    1,532
    Likes Received:
    3,236
    Trophy Points:
    113
    Gender:
    Male
  4. tervalas

    tervalas Avatar

    Messages:
    50
    Likes Received:
    9
    Trophy Points:
    8
    Best place to report a possible bug with ShroudOnMouseClick?

    Is it supposed to trigger 5 times on one left click?

    Also, don't suppose you can modify it to handle other types of clicks?
     
  5. DavidDC

    DavidDC Programmer Moderator SOTA Developer

    Messages:
    1,532
    Likes Received:
    3,236
    Trophy Points:
    113
    Gender:
    Male
    There is some bug currently in lua using multiple script that doesnt have the same function, that cause problem but will be fixed in next release i just fixed it.
    There also another problem i saw with my new UI which doesnt stick when loading a new scene, which then cause a lost of all ids and you cant manipulate the UI anymore, will also be fixed in next release (18 november!)
    Ill check throw back some event data with the mouseclick to know if its left right or middle click etc
     
    Anpu likes this.
Thread Status:
Not open for further replies.