Skip to content

[Question] Lua scripting. #72

@juliolitwin

Description

@juliolitwin

Your project is incredible, it's rare to see emulation projects for C# lovingly developed! :)

There isn't a discord group or anything like that, so I would like to ask about an issue regarding lua.

It's not necessarily about MS, but rather your implementation of Lua, I saw that some of your scripts wait for a response from the user, such as ask_menu, could you explain to me how you manage this?

Sample:

if target.field == mapFields.getID("NLCSubwayStation") then
    selection = self.ask_menu("Hello. Would you like to buy a ticket for the subway?", {
        [0] = "Kerning City of Victoria Island"
    })

    if selection == 0 then
		ticket = charInventory.selectTicketToVictoriaFromNLC()
		cost = charInventory.getPriceOfTicket(ticket)

        if self.ask_yes_no("The ride to Kerning City of Victoria Island takes off every " .. target.as_continent().term .. " minutes, beginning on the hour, and it'll cost you #b" .. cost .. " mesos#k. Are you sure you want to purchase #b#t" .. ticket .. "##k?") then	         
			charInventory.buyTicket(ticket, cost)
        else
            self.say("You must have some business to take care of here, right?")
        end
    end

When ask_menu is called, you call AskMenu (in C#), but in the Lua background, it waits for the return at the exact point where it stopped executing? Do you make any kind of use of threads/coroutines?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions