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

Offlinetraining Error (TFS 1.4.2)

Wusse

Member
Joined
Oct 3, 2023
Messages
33
Reaction score
6
Hey!

I have Compiled and started TFS 1.4.2 for 10.98, everything works fine, one issue i do get tho is an ERROR in Console after someone logs in and have been "training" while being abscent. (The offline training works, i simply get a error in console)

TRAINING WORKS:

ERROR:


Help is highly appreciated ^^!
 
Solution
Seems to be kind of the same as this issue, check it out, might be instructive.

Here's a documentation on signed ints

And here is one for unsigned ints

Basically, signed ints lets you go into negative territory, while unsigned ints does not. (At the cost of having a lower "ceiling")
Your 'setOfflineTrainingSkill' in the script tries to return a negative number. Since it is somewhere defined to be unsigned, that is simply not allowed.

Search your /src folder with Notepad++ and...
Seems to be kind of the same as this issue, check it out, might be instructive.

Here's a documentation on signed ints

And here is one for unsigned ints

Basically, signed ints lets you go into negative territory, while unsigned ints does not. (At the cost of having a lower "ceiling")
Your 'setOfflineTrainingSkill' in the script tries to return a negative number. Since it is somewhere defined to be unsigned, that is simply not allowed.

Search your /src folder with Notepad++ and find all mentions of setOfflineTrainingSkill, then you just reverse engineer until you find where it is defined to be unsigned, then you figure out if it's feasible to change it to signed instead and then proceed if it is feasible or use trial and error. Then it should be solved.

I found something interesting in 'game.cpp' and 'luascript.cpp'.

You can PM me if you run into any issues and I'll try my best to help.
 
Last edited:
Solution
Hey and thanks for the reply!

I already followed and changed everything according to this post:

The only one i did not change since i got an issue last time i tried was:

I did check your sneaky little spoiler directing me into game.cpp and luascript.cpp and found these codes:

luascript.cpp:

game.cpp:

Though i have to be honest, im having a hard time figuring out what i should change to not get a -1 variable on these two codes ^^
 
Try and avoid just copy and pasting code without knowing what it does or without using a testing environment such as a dev version of your main distro. It can cause more problems than it solves. Try and understand why it fixes something and what's different from the old code.

In any case, you shouldn't change the script, but rather change the sources to use int32 instead of uint32 since your script wants to call -1.
As far as numerical values goes for signed ints, its range is -2,147,483,647 to 2,147,483,647 instead of 0 to 4,294,967,295 for unsigned ints.
I don't think it makes any difference for this particular piece of code and it gives your script the freedom to use negative values.

There are few instances where it is better to use unsigned ints, this does not seem to be one of them, at least at first glance. You won't know for sure, but if it ever throws an error in the future you're better equipped to deal with it since you learned from fixing this.

It's always better to try and tweak scripts to fit with the sources than what I just proposed which is a complete contradiction to that practice. But considering the code, I don't immediately see any issues in changing it to signed. Others can correct me if I'm out hiking on Mount Sternum though.

Try those changes and see what happens when you compile and get the script to activate.

Let me know if any issues arise.
I could also guide you on Discord through screen sharing.
 
Last edited:
hehe im trying to learn but this is extremly hard to understand, i have very little c++/c#/lua knowledge most ive gotten from school and i am interested in this but i get overwhelmed extremly easily ^^ im out of my league of expertise.

i will make the changes of int32 instead of uint32 and see if that would solve the issues im facing, appreciate your time and id love to go into dsicord and have a chat to get a better understanding of everything ^^!
 
Back
Top