Jump to content

Lua return from select


Recommended Posts

Hi, I'm doing quest for NPC and i have select for weapons.... In this select i have "Swords" "Daggers" and so on.... In "Swords" i have "Swords 1", "Swords 2", "Swords 3". 

When I'm in sword selection and I click on "Close", I want the quest to go back to "Weapon selection", which means 1 step "select" back... I tried return, but it is not working and the whole quest closes.... Do you know how to do it? :)

 

Thank you! :)

Link to comment
Share on other sites

There are many options how to approach this.

You'd write this stuff into a function and just call it again once the player chooses "Close". Note that you'd at least give the player an option to properly exit the function, otherwise you're calling it recursive with no getting out, trapping the player in an endless loop of hopelessness. People start to forget the player's name as they're fading into oblivion, down the spiral of endless torture as they loose their understanding of time and space and their existence enters nothingness.

tl;dr: Recursive function is the key, but make sure you let the player exit it somewhere.

  • Love 1

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

I'm not 100% sure if you can do this on Metin2, but lua has a goto statement too.

http://lua-users.org/wiki/GotoStatement

If that's possible there you can just use it and "return" back to the prior code. But I absolutely hate goto stuff... So use it at your own risk, I'm not even sure if Metin2 can handle it

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

1 hour ago, Vanilla said:

I'm not 100% sure if you can do this on Metin2, but lua has a goto statement too.

http://lua-users.org/wiki/GotoStatement

If that's possible there you can just use it and "return" back to the prior code. But I absolutely hate goto stuff... So use it at your own risk, I'm not even sure if Metin2 can handle it

goto statement is only available in lua 5.2+(metin2 original source uses 5.0)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.