• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Is there a way to manage MySQL queries from LUA?

admkhbr

Member
Joined
Mar 24, 2014
Messages
31
Reaction score
17
Well, i never liked creating accounts from a website with any kind of CMS (like Znote), so always looked for servers with 1/1 acc maker. Since TFS 1.0, there isn't 1/1 Acc Creator, so the only option is using a website. I don't like it, just don't, and preffer don't make any otserver than use a WWW (i know how to setup XAMPP, mySQL and everything, i just don't like it, it's too boring and slow, i even don't like playing ots that must enter a site to make acc, because i dont play otservers seriously, and it's just a waste of time, i became lazy and don't try many ots). So i was thinking about develop a mod for OTClient, to create acc/character.

Of course there's a way. Actually, i'm working on it right now, but it's just a PHP/MySQL system with new clothes (just like Znote). If i could just create new data in mySQL tables using LUA, it would be better, a lot better. For example, make a NPC that create accounts (of course it will not be like this, but this is the way).

2ykauc6.png

Thanks for your attention.

@EDIT: People, don't get me wrong, Znote is awesome, and I do admire guys job. I just don't like any kind of WWW, personally.
 
Last edited:
Solution
For communication between OTClient and the server, have a look at extendedopcodes:
forgottenserver/extendedopcode.lua at master · otland/forgottenserver · GitHub

There isn't much sample data on TFS on this particular thing, perhaps check out the OTClient board and the OTX distro for some documentation/code usages on this.
But basically you should be able to post custom data to the server, all queries should be dealt server-side.

On the server Lua side, you can store and evaluate query return data like I do in this shopsystem script:
ZnoteAAC/znoteshop.lua at master · Znote/ZnoteAAC · GitHub

If you don't intend to do anything with return query data, regular db.queries seem to also do the trick:
forgottenserver/20.lua at...
For communication between OTClient and the server, have a look at extendedopcodes:
forgottenserver/extendedopcode.lua at master · otland/forgottenserver · GitHub

There isn't much sample data on TFS on this particular thing, perhaps check out the OTClient board and the OTX distro for some documentation/code usages on this.
But basically you should be able to post custom data to the server, all queries should be dealt server-side.

On the server Lua side, you can store and evaluate query return data like I do in this shopsystem script:
ZnoteAAC/znoteshop.lua at master · Znote/ZnoteAAC · GitHub

If you don't intend to do anything with return query data, regular db.queries seem to also do the trick:
forgottenserver/20.lua at master · otland/forgottenserver · GitHub

Still, many OT owners like to have a website to represent their community, show in-game statistics etc.
Znote AAC has a base form of JSON API:
http://demo.znote.eu/api/

With this you can have both worlds. The extensive Znote AAC features, and you can build a json API for account and character creation in otclient. Where otclient only gather and send post requests to the website, which then does the magic and sends the response back to otclient.

Sample1: (Lots of comments on how to use json api)
ZnoteAAC/blank.php at master · Znote/ZnoteAAC · GitHub

Sample2: (return a list of top players/highscore based on xp)
ZnoteAAC/topExperience.php at master · Znote/ZnoteAAC · GitHub

Output: http://demo.znote.eu/api/modules/highscores/topExperience.php?rows=3 (Configured to 3 rows in URL)
 
Last edited:
Solution
Wow, thanks, very good stuff to take a look! I'm sure this is enough, now just some study to put all things on.

Like I said, i know many people like WWW. In fact, Znote is great. Personally, i don't like any website for acc manager, but you're right about the community, never thought this way. It's better keep both worlds.

Thanks Znote, i couldn't expect better answer!!
 
Back
Top