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

When will TFS 1.4 be released?

fabian766

Veteran OT User
Joined
Apr 22, 2008
Messages
128
Solutions
21
Reaction score
320
Location
Poland
@fabian766
I admire you and admire your work with your tfs.
why don't you write in the official tfs or because your tfs doesn't become the official?
Personal reasons.

1. Pretty sure the conditions could be written in a more elegant way (some loop very likely).
2. enter key not used enough, everything is just clumped together
3. adding condition, sending a message and sending magic effect could be moved to some configurable table
4. things from point 3 and item:remove(1) could be moved outside of if/elseif chain because it's a single instruction that runs in every case so the code could be a few lines shorter. Cases in which the food can't be used could be handled by return statement before reaching item removing instruction.
5. Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid)) Why are they even using cid to add health to player when player variable is available and proper methods to do that without using cid were introduced?
1. Yeah, it can but why should the code look elegant? It isn't casting or anything like that. About loops if you're a programmer you should know that you should use loops only when completely necessary so stop abusing those poor loops.
2. Yeah, similarly in STL libraries that every programmer like to use them, then authors of those libraries write bad code?
3. Making simple script over-configurable? Yeah why not. Just because script doesn't have "local config = {someshit}" doesn't mean it is bad.
4. So having disability to use enter key is bad because you're saving so much lines but having additional lines that does the same thing is bad? Interesting.
5. I already asked who decided that it is wrong? Those compatibility functions are there to be used even if it looks weird, if it is that bad then why keeping them at all?

It is not a complaint that the code work bad, just that someone else should have taught him to design the code correctly and then be merged, and please do not come out and insult me, I already know that I am not good with codes UwU
The great thing about programming is that there isn't something like correctly code design, you can code as you want if you're write proper code that actually works. Saying things like this you're only scaring new people to even try to learn anything.

@fabian766 I would like to see an example of a badly designed or cumbersome-looking code in the official TFS, just out of curiosity, I like gossip 🙈
I'll leave it to myself as it is more funny that way because I can later laugh at people that think how good the code from main repository is or even crash servers from people I don't like(currently there aren't any of those but who knows what will bring future).
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
618
Solutions
57
Reaction score
451
Location
London
GitHub
MillhioreBT
Personal reasons.


1. Yeah, it can but why should the code look elegant? It isn't casting or anything like that. About loops if you're a programmer you should know that you should use loops only when completely necessary so stop abusing those poor loops.
2. Yeah, similarly in STL libraries that every programmer like to use them, then authors of those libraries write bad code?
3. Making simple script over-configurable? Yeah why not. Just because script doesn't have "local config = {someshit}" doesn't mean it is bad.
4. So having disability to use enter key is bad because you're saving so much lines but having additional lines that does the same thing is bad? Interesting.
5. I already asked who decided that it is wrong? Those compatibility functions are there to be used even if it looks weird, if it is that bad then why keeping them at all?


The great thing about programming is that there isn't something like correctly code design, you can code as you want if you're write proper code that actually works. Saying things like this you're only scaring new people to even try to learn anything.


I'll leave it to myself as it is more funny that way because I can later laugh at people that think how good the code from main repository is or even crash servers from people I don't like(currently there aren't any of those but who knows what will bring future).
I ran out of the gossip uwu

Thanks for answering and if you are right, the compatibility functions are there to be used, I have a friend who is used to creating codes in old engines and has not lost the habit of coding in his own way, I suppose he is grateful that they still exist compatibility features.
 

fabian766

Veteran OT User
Joined
Apr 22, 2008
Messages
128
Solutions
21
Reaction score
320
Location
Poland
There is a correct way to write code. That would be the most efficient, and readable is the correct way. Just because it works doesn't mean its good.

Yeah, no.
Yeah, no.
The correct code is the code that works as it should and have the least amount of bugs(if possible doesn't have any).

"most efficient" okay how did you measure that the way you write code is the most efficient? What if you're wrong and using your local config hashtable is actually less efficient than using simple elseif's? Stop forcing premature optimizations on others because you think it is the right way to do things. If they'll face performance problems then it is theirs problem and they'll look for ways to optimize their code(and learn how to write "better" code that way).

"readable" you know that depends from person to person? If someone write code it is fully readable for him/her but might not be for you so stop imposing to others your personal opinion whether their code is readable because it is useless.
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,842
Solutions
49
Reaction score
546
Yeah, no.
The correct code is the code that works as it should and have the least amount of bugs(if possible doesn't have any).

"most efficient" okay how did you measure that the way you write code is the most efficient? What if you're wrong and using your local config hashtable is actually less efficient than using simple elseif's? Stop forcing premature optimizations on others because you think it is the right way to do things. If they'll face performance problems then it is theirs problem and they'll look for ways to optimize their code(and learn how to write "better" code that way).

"readable" you know that depends from person to person? If someone write code it is fully readable for him/her but might not be for you so stop imposing to others your personal opinion whether their code is readable because it is useless.
Its okay if you can't understand what I'm saying. Just say that. If you go to school for coding at all they will teach you this stuff. I'm not being paid so I'm not going to sit here and teach you.
 

Silba

Well-Known Member
Joined
Aug 22, 2013
Messages
140
Solutions
1
Reaction score
64
I keep hearing that our average age has gone up in the OT community, this thread is kinda worrying in that regard. Part of growing up is learning what is subjective and why arguing about such things is nonsense.

Chill bros, Merry Christmas and stop being so hostile over such nonsense. OPEN Tibia, cmon man.
 

WibbenZ

Global Moderator
Staff member
Global Moderator
Joined
Oct 16, 2008
Messages
6,303
Solutions
225
Reaction score
1,289
Location
Sweden
Yeah, no.
The correct code is the code that works as it should and have the least amount of bugs(if possible doesn't have any).

"most efficient" okay how did you measure that the way you write code is the most efficient? What if you're wrong and using your local config hashtable is actually less efficient than using simple elseif's? Stop forcing premature optimizations on others because you think it is the right way to do things. If they'll face performance problems then it is theirs problem and they'll look for ways to optimize their code(and learn how to write "better" code that way).

"readable" you know that depends from person to person? If someone write code it is fully readable for him/her but might not be for you so stop imposing to others your personal opinion whether their code is readable because it is useless.

I don't want to break you're bubble but I hope you understand that ex this
Lua:
local cid = player:getId()
doPlayerAddItem(player:getId(), 2160, 5)

Will be longer / require more than this
Lua:
player:addItem(2160, 5)

I have a feeling that I need to explain it, so here it goes:
1. There is no reason to create a variable where you store the creature id value when you already have the userdata value from the function itself (TFS 1.1?)
2. There is no reason to use a compatability function since, yes it will perform the same but you're actually cracking the egg 2 times insted of once.

When it comes to the code I linked, from the OT BR repo:
1. Tables are preferable to loops unless it's 1-2 (or few of them) statments.
2. If you use if / elseif statments correctly there is no reason to use return values, since the table itself will terminate.
The "pro" of using a table code is that you only have to call certain functions once, ex in your code there is no reason to load item:remove x times compared to once when the code is loaded.
3. There is no reason to "reload" a local table that won't change (in this case r_t (w/e that is) everytime the function is loaded.
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,842
Solutions
49
Reaction score
546
I keep hearing that our average age has gone up in the OT community, this thread is kinda worrying in that regard. Part of growing up is learning what is subjective and why arguing about such things is nonsense.

Chill bros, Merry Christmas and stop being so hostile over such nonsense. OPEN Tibia, cmon man.
The hostility is coming from him acting like it doesn't matter how you code. That is not what we should be teaching people. His attitude is screw it, its not our problem if they don't code correctly. Considering my coding journey started here, for someone to have an attitude like that on this forum is disgusting.

I don't care how he codes, he can do it his way but im going to explain it's not right. Coding is not subjective, there are parts that can be subjecting (naming functions, ect.) but without doubt there is a correct way and an incorrect way in every part of coding. It pissed me off reading "Its not your problem so why should you care" on a forum that's literally built for sharing information.

He is a disgrace to himself and the community speaking like that.
 

CesarZ

Active Member
Joined
Sep 20, 2012
Messages
173
Reaction score
28
is there away you guys can keep the same Functions? help a noob become a coder. I keep stopping every time at Luascript.cpp to learn and figuring out them functions. is like a school that never ends.:rolleyes:
 

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
2,838
Solutions
10
Reaction score
1,832
Location
Poland
is there away you guys can keep the same Functions? help a noob become a coder. I keep stopping every time at Luascript.cpp to learn and figuring out them functions. is like a school that never ends.:rolleyes:
I still have luascript.cpp open when I code new things. It's so clean that it can be read as a documentation.
 

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,631
Solutions
26
Reaction score
1,240
Best thread 2020, ending the year in good fashion.

Not sure which side I should pick, the one that believes there is only one way to do it right or the one that thinks whatever works is awesome.

In my head there are good pratices and there are some standards that should be met when you dealing with a big community driven project that need to be maintained in the long run. Pursuing some insane high standard doesn't makes sense, because the project will be stuck forever, as accepting any sort of shit also has a cost.
 
Last edited:

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,306
Solutions
101
Reaction score
1,281

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
618
Solutions
57
Reaction score
451
Location
London
GitHub
MillhioreBT
Top