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

Newcomer with question :D

Anghelos

Member
Joined
Nov 1, 2014
Messages
30
Reaction score
10
Hi all, i'm new :)
I like Tibia and retro style (my fav is Uol for instance :D) and I was playing in a nice server...so i decided to get a look on what's behind the scene, so lately i started to lurk inside this forum.

I don't know how usually works, but I found pretty bothering the fact that I couldn't check the raids event when i was logging in in the game, like go in Venore and find thousands of Feverished Citizen attacking me in all of a sudden, or going out Thais and found a lot of orcs surprising me. I would love to have a page in the site where i could check what are the last event appeared on the server. So in these 2 days I was searching through the Gesior and Znote layout and script something that was simply doing this:

a web page, that as a raid or event is shown in the server, its posted on the page, something like:

Event Name, Type, Hour
Rats Plague, Raid, 3 November 12:41 AM

As a Computer Scientiest i guess it would be something very easy to do, just a DB query on the php side...but the fact that noone did something like that make me guess that is more complicated than this..

So...any clues?
 
Actually, it ain't too hard. I think that not many have thought of it yet. If you're using TFS 1.0 you might have a problem with adding it to the site since some kind of value needs to be stored in the database for the site to read. Best way would be to re-implement global storage values (which could be found in older versions of OT distributions) into the database and then add storage values to each world event script. This would make it possible to have world events going over a few server saves.

Though this can also be done easily by just adding that world event board (or an npc) and script it to only show a sentence when that current world event is active (though this wouldn't appear on the website, but it would give a heads-up in-game).

That would be what I would try.
 
yeah the server i'm playing is using TFS 1.0. But I actually thought about that...i have no idea how works the script/programming here, but ideally I would store the event name, and hour in a new table as soon as they happend in game, and then just query it from the site when requested.
Now i need to learn HOW to do it ,-) But i seriously thought that some1 else had done this before...
 
yeah the server i'm playing is using TFS 1.0. But I actually thought about that...i have no idea how works the script/programming here, but ideally I would store the event name, and hour in a new table as soon as they happend in game, and then just query it from the site when requested.
Now i need to learn HOW to do it ,-) But i seriously thought that some1 else had done this before...
No one has done it before, it is EXTREMELY easy to do though.
You simply add a new table in the SQL Database, add in the things you would like to define (Raid, Name, Time, etc) then when a raid is executed by TFS 1.0 just have it write that information to the database.

You can even do it in LUA if you want. (assuming TFS 1.0 supports database queries in LUA, but since item attributes, the account manager, and other things that I consider basic functionality have all been removed its possible they removed that possibility as well).

Honestly at this point i'm surprised that TFS 1.0 will even run if you don't have the map named "Stolen Cipsoft Map" since that is precisely the only type of server it supports.
 
Ok thanks, one more question, if I want to start doing that, and programming about, where should I start? what should I download? (ok, prolly a TFS 1.0 server i guess, but what kind? Github maybe?) and what file is about the raids?

Thx in advance for the answers and sorry being such a noob ^_^
 
Ok thanks, one more question, if I want to start doing that, and programming about, where should I start? what should I download? (ok, prolly a TFS 1.0 server i guess, but what kind? Github maybe?) and what file is about the raids?

Thx in advance for the answers and sorry being such a noob ^_^

TFS 1.0 has an own folder for raids, look at it here: https://github.com/otland/forgottenserver/tree/master/data/raids

And yeah. Use tfs 1.0, it is the best you gonna find:
https://github.com/otland/forgottenserver

The most tfs 1.0 functions can you find here:
http://otland.net/threads/tfs-1-0-lua-functions.197202/

Also look at luascript.cpp to find some cool stuff,
https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp
 
As an extension to @Cornex post above, what you'd like to do is, add a script tag to each raid file (not the main raids.xml, but each separate raid .xml file) to specify a custom LUA script.
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<raid>
    <script script="my-raid.lua" delay="0" />

    <!-- Custom raid functionality, e.g. <announce>, <areaspawn> & <singlespawn> -->
</raid>
This would then, immediately upon the execution of the raid, run your "my-raid.lua" file, located within the ./data/raids/scripts/ folder. Unfortunately, the onRaid function does not pass any parameters, as far as I can tell. So you would have to create a separate file for each raid (as there is no way to dynamically tell which raid was executed, unless you do source edits, that is).
Code:
function onRaid()
    local raid = "My Raid"
   
    db.query("INSERT INTO `raids` (`raid`, `executed`) VALUES(" .. db.escapeString(raid) .. ", " .. os.time() .. ");")

    return true
end
Code:
CREATE TABLE `raids` (
    `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `raid` VARCHAR(255) NOT NULL,
    `executed` INT(11) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB;
 
I guess I get it...as soon as i have a bit of time i'll post it here, maybe some1 else might find it useful. And thanks a lot for ur help!
 
I was thinking how can i avoid the creation of all these files, one for each raid...so...the questions are:

can i put a global var inside the xml? so as soon as the xml is executed a global var changes and when i start the lua script (with the table update) it will go to read the global var and catch the event?
 
I doubt very much that they have included a way to parse character data as of right now (if ever?). Your only safe bet is to do every file manually like I mentioned in my previous entry. Hopefully though, in a future release, they'll consider adding e.g. the raid name as a parameter of the onRaid function.

I have not however done any extensive research through the raids.cpp file, so feel free to prove me incorrect.
 
Ok. So far I installed my TFS 1.0, read tutorials and watched video and finally managed to:
download the forgottenserver and last release executable file, fix the Znote site for accounting after installing xampp and configuring DB for the site and for the server...and also the server starts. The point is that i can't login, nor with normal client, nor with OTclient.

Even if i opened the port 7171 and 7272 both TCP and UDP and both allowing connection in entrance or exit, i receive the following error when I try to login after creating the carachter through the site:

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/firstitems.lua:onLogin
data/creaturescripts/scripts/others/firstitems.lua:30: attempt to index local 'p
layer' (a number value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/others/firstitems.lua:30: in function <data
/creaturescripts/scripts/others/firstitems.lua:29>
Test Player has logged out.


I tried a lot of stuff, checked the forum (that's why I allowed the 7171 and 7172 connections) but nothing work....i have no more clues...any help?
 
Send me your TeamViewer credentials through a private message and I'll help you get started.
 
Back
Top