Saturday, November 7, 2020

Linux compiler error that never shown on Visual Studio

let's just admit Visual Studio sux ... ok ?

right now, if you want to host a Private Ragnarok Online server, its just better to choose Debian or CentOS option
the reason is because if you choose Windows Server Edition on VPS,
the cost of running on Windows is often double or triple compare to Linux environment

because of this, programmer like me who write and compile their plugin/source code with Visual Studio,
it will work fine on Windows environment.
But when apply the code on Live server (Linux environment), it will throw non-sensible error

No.1
warning: implicit declaration of function ‘atoi’ [-Wimplicit-function-declaration]

Avoid using atoi like plague !!
in npc scripting its the only script command to convert string into int
yes, this actually working fine with Visual Studio, but on Linux ...



No.2
error: a label can only be part of a statement and a declaration is not a statement

Sample



this case have to be enclose with curly bracket, like this


No.3
warning: unused variable ‘len’ [-Wunused-variable]

Sample
this is very annoying, because I want to output the value from 4th argument, but the 2nd argument isn't use
on Windows this is fine, but on Linux it throws that error throw off my guard

change


there might be more, will keep this update

Monday, November 2, 2020

Page by page

*mes

sometimes you want to display a long long array list of objects,
for example print out all values from a table
this will throw infinite loop ERROR

the reason is because the script engine has some protection against infinite loop check
conf\map\script.conf
even if you put a *freeloop there, it might still lag the server

in this case, its better to just display page by page


if the *query_sql still cause lag, have to use OFFSET


and this is with page input for your amusement :)



*select

same as above this will throw infinity loop ERROR
even if you put a LIMIT syntax this will throw menu length too long / too many options ERROR

this is because the maximum limit of menu length in string (eg: *getstrlen) is 2047
and the maximum limit of menu options is 254
src\map\script.h
and I don't recommend changing this, as you also have to change the packet structure etc ...

so the only way to remedy this ... is again ... page by page

if the query_sql still cause lag, have to use OFFSET


and the page select display for your amusement :)


External Links:
Help - Array in menu

Linux compiler error that never shown on Visual Studio

let's just admit Visual Studio sux ... ok ? right now, if you want to host a Private Ragnarok Online server, its just better to choose...