• 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!

Using lua instead of xml

This feature, what distribution would you like to see it in?

  • 0.3.6

    Votes: 4 26.7%
  • 0.4

    Votes: 4 26.7%
  • Otx 2/3

    Votes: 0 0.0%
  • Tfs 1.0

    Votes: 0 0.0%
  • Tfs 1.1

    Votes: 0 0.0%
  • Tfs 1.2

    Votes: 2 13.3%
  • Tfs 1.3

    Votes: 5 33.3%

  • Total voters
    15
I've worked on pretty much the same thing quite a while ago.
It might be of some help and it's an already working server example of how lua can handle all of that easily
https://github.com/EvilHero90/forgottenserver
Well I appreciate the contribution but this variation at 1st glance still relies on xml which is something I want to avoid using. I'll look it over though to see what I can learn from your perspective of things. :)
 
Here is a simple example. This is a section taken from 0.3.6 actions.xml
Code:
     <!-- Weapons enchanting (Gems) -->
    <action itemid="2146" event="script" value="other/enchanting.lua"/>
    <action itemid="2147" event="script" value="other/enchanting.lua"/>
    <action itemid="2150" event="script" value="other/enchanting.lua"/>
    <action itemid="2149" event="script" value="other/enchanting.lua"/>
    <action itemid="7759" event="script" value="other/enchanting.lua"/>
    <action itemid="7760" event="script" value="other/enchanting.lua"/>
    <action itemid="7761" event="script" value="other/enchanting.lua"/>
    <action itemid="7762" event="script" value="other/enchanting.lua"/>

And this this how it will be loaded from lua instead.
Code:
 assignAction({2146, 2147, 2150, 2149, 7759, 7760, 7761, 7762}, 0, "other/enchanting.lua")
This function not only loads tables but it also handles individual ids but also ranges as well as functions/scripts or action/event types such as aid, uid, itemid and so forth.
 
I'd prefer if registration is done 1 by 1

assingAction(INT, STR, STR)
assingAction(itemID/itemAID, "itemID"/"itemAID", "location.lua")

if we want to register more ID's on same file, we can simply make loop for them
Also it makes it more consistent with other functions.
you don't see functions what take numbers and/or tables as parameters as often in default TFS


but why do we even need location?
assignAction loads files and looks for onUse() function?

instead maybe write function name? Let the user who creates the file organize it.
Need to make sure /reload will reload all files in action folder
I have lua talkaction !dofile FILE_NAME which reloads specific file, maybe you can write in in source and let source find the file from data folder and reload it
 
Last edited:
Here is a simple example. This is a section taken from 0.3.6 actions.xml
Code:
     <!-- Weapons enchanting (Gems) -->
    <action itemid="2146" event="script" value="other/enchanting.lua"/>
    <action itemid="2147" event="script" value="other/enchanting.lua"/>
    <action itemid="2150" event="script" value="other/enchanting.lua"/>
    <action itemid="2149" event="script" value="other/enchanting.lua"/>
    <action itemid="7759" event="script" value="other/enchanting.lua"/>
    <action itemid="7760" event="script" value="other/enchanting.lua"/>
    <action itemid="7761" event="script" value="other/enchanting.lua"/>
    <action itemid="7762" event="script" value="other/enchanting.lua"/>

And this this how it will be loaded from lua instead.
Code:
 assignAction({2146, 2147, 2150, 2149, 7759, 7760, 7761, 7762}, 0, "other/enchanting.lua")
This function not only loads tables but it also handles individual ids but also ranges as well as functions/scripts or action/event types such as aid, uid, itemid and so forth.
looks terrible no offense. I'd call this "how to achieve unreadability"
 
Here is a simple example. This is a section taken from 0.3.6 actions.xml
Code:
     <!-- Weapons enchanting (Gems) -->
    <action itemid="2146" event="script" value="other/enchanting.lua"/>
    <action itemid="2147" event="script" value="other/enchanting.lua"/>
    <action itemid="2150" event="script" value="other/enchanting.lua"/>
    <action itemid="2149" event="script" value="other/enchanting.lua"/>
    <action itemid="7759" event="script" value="other/enchanting.lua"/>
    <action itemid="7760" event="script" value="other/enchanting.lua"/>
    <action itemid="7761" event="script" value="other/enchanting.lua"/>
    <action itemid="7762" event="script" value="other/enchanting.lua"/>

And this this how it will be loaded from lua instead.
Code:
 assignAction({2146, 2147, 2150, 2149, 7759, 7760, 7761, 7762}, 0, "other/enchanting.lua")
This function not only loads tables but it also handles individual ids but also ranges as well as functions/scripts or action/event types such as aid, uid, itemid and so forth.
Code:
    <!-- Weapons enchanting (Gems) -->
    <action itemid="2146;2147;2149;2150;7759-7762" event="script" value="other/enchanting.lua"/>
 
Code:
    <!-- Weapons enchanting (Gems) -->
    <action itemid="2146;2147;2149;2150;7759-7762" event="script" value="other/enchanting.lua"/>
maybe even this, :O
Code:
<action itemid="2146-2150;7759-7762" event="script" value="other/enchanting.lua"/>
 
Code:
    <!-- Weapons enchanting (Gems) -->
    <action itemid="2146;2147;2149;2150;7759-7762" event="script" value="other/enchanting.lua"/>
I am happy that you pointed this out. Yes you can add multiple ids to actions using this method. Alright well later today I will provide a better example of why this feature would be more idealistic than what currently exists.
 
I'd prefer if registration is done 1 by 1

assingAction(INT, STR, STR)
assingAction(itemID/itemAID, "itemID"/"itemAID", "location.lua")

if we want to register more ID's on same file, we can simply make loop for them
Also it makes it more consistent with other functions.
you don't see functions what take numbers and/or tables as parameters as often in default TFS


but why do we even need location?
assignAction loads files and looks for onUse() function?

instead maybe write function name? Let the user who creates the file organize it.
Need to make sure /reload will reload all files in action folder
I have lua talkaction !dofile FILE_NAME which reloads specific file, maybe you can write in in source and let source find the file from data folder and reload it
It looks as if you just responded to the example code but have not read the accompanying text. Also to everyone else picking apart the example this function assignAction is not the feature but a product of it you it. The server will read or parse a file which is meant for actions made entirely up in lua. Meaning you can write your own implementation of how the data is loaded very much similar to how you define the scripts in the interfaces or npc`s.

Similar to the code I've already released in the C++ section of this site for both items and vocations.

I am starting to think that this community is afraid, fear to explore unknown boundaries in development. The sole purpose of xml is to store data which was never meant to change (might as well put it in a text file). You can not store information in an xml file without writing over the file. There is no means of preprocessing an xml file (from within the file itself) so this makes it a very unlikely candidate for data manipulation in game development.
 
Last edited by a moderator:
I am starting to think that this community is afraid, fear to explore unknown boundaries in development. The sole purpose of xml is to store data which was never meant to change (might as well put it in a text file). You can not store information in an xml file without writing over the file. There is no means of preprocessing an xml file (from within the file itself) so this makes it a very unlikely candidate for data manipulation in game development.
yes the community is extremely afraid of changing from xml to lua registration for everything when xml works just fine for that vast majority of the community
 
yes the community is extremely afraid of changing from xml to lua registration for everything when xml works just fine for that vast majority of the community
The code I've seen produced on this forum using xml is limiting your perspective of what can be accomplished on a server. Xml has its place for minor things which were never meant to change sure. But the reason there are not more diverse systems in place is due to closemindedness which seems to be rampant. I 100% guarentee when the final product is released you will see a lot more servers using this variation of tfs and it may even make its way into the official branch. Leaving all you xml lovers behind, if you want to keep up with technology you must change with it.
 
Leaving all you xml lovers behind, if you want to keep up with technology you must change with it.
it seems as if you are assuming my sexuality.
i never said i was an xml lover.
 
Every script I have ever released you people have used on your servers. Every tutorial I have ever written you people have embraced (proof is in the downloads). I have been writing code for this community on various accounts for years. If it were not for my contributions to this community you would all still be scratching your heads on what to do next. @Xeraphus I don't know why you keep replying you are a mediocre scripter at best and don't fully have a grasp on lua. @whitevo I think you are just lost in the English language. @tokenzz so what you are taking a course on computer science that does not make you an authority on all things code related. @cbrm why are you even a mod? All you do is make one liner comments and ban people you don't like. @Evil Hero thank you for the contribution I will use it wisely. @Raggaer you don't seem to know anything. To everyone else I missed and that has a problem with my code or statements produced. Fuck you, keep on following these lame ass people who know absolutely nothing about developing. This is the very reason why tfs as a whole has not changed very much since its inception.

Otland has become a community of entitled unknowledgeable people with little to no direction or emphasis on growth or education. This closemindedness is what is killing your community. Unfortunately most of you you can't seem to see past your own ignorance.

Yes this is Codex, again go fuck yourselves. Happy New Year!

I won't be responding to this thread any further, not because of the impending ban but just because you people are not even worth the characters.
 
Every script I have ever released you people have used on your servers. Every tutorial I have ever written you people have embraced (proof is in the downloads). I have been writing code for this community on various accounts for years. If it were not for my contributions to this community you would all still be scratching your heads on what to do next. @Xeraphus I don't know why you keep replying you are a mediocre scripter at best and don't fully have a grasp on lua. @whitevo I think you are just lost in the English language. @tokenzz so what you are taking a course on computer science that does not make you an authority on all things code related. @cbrm why are you even a mod? All you do is make one liner comments and ban people you don't like. @Evil Hero thank you for the contribution I will use it wisely. @Raggaer you don't seem to know anything. To everyone else I missed and that has a problem with my code or statements produced. Fuck you, keep on following these lame ass people who know absolutely nothing about developing. This is the very reason why tfs as a whole has not changed very much since its inception.

Otland has become a community of entitled unknowledgeable people with little to no direction or emphasis on growth or education. This closemindedness is what is killing your community. Unfortunately most of you you can't seem to see past your own ignorance.

Yes this is Codex, again go fuck yourselves. Happy New Year!

I won't be responding to this thread any further, not because of the impending ban but just because you people are not even worth the characters.
that's quite rude.
 
Yes this is Codex, again go fuck yourselves. Happy New Year!
ILHmnrJ.png

Dad, are you out of sync?
 
Seems like a very cool release, I would love to have lua's versatility on registering my scripts.
Cheers.
 
Back
Top