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

Solved Function string error in mod :/

Fails at line 114 of the text in the link, db.query(....

The error means: 'couldn't find Lua function "query" on object "db" '. (FWIW the odds are good "db" is an object instance encapsulating a database connection, and "query" is a method call on the object, but I CBA checking because it makes no real difference here :)


That format "db.query" is used in my TFS 1.0, so I suppose you're on an earlier level.

You probably just have to change all the Lua-DB calls to the old format (I don't know what it is, but look around in any scripts that save status to the database (a lot of the PvP code does this) and you'll see examples).
 
Last edited:
I could, but I won't :)

I don't have a copy of the mod, and anyway I only have a relatively new TFS 1.0. which isn't currently running, so I can't test any changes.

BTW:
If this was just 10 minutes work I'd do it, because it would be almost as fast as posting here ...
... but the trouble with back-level code is that it might be a "black hole". You can never tell in advance if back-level code will be easy to upgrade, or if you'll have to make a lot of different changes to make it work ... i.e. it sucks you in and screws up the way time passes like a black hole :)

Up to a point I can help you fix it yourself, but I don't want to make any promises I can't keep.

FWIW, there are only a few distinct database-calling Lua functions used in OT, and they all look similar because of the SQL code that's passed as a parameter:
All that stuff in quotes that looks a bit like this:
"select from tab1, tab2, where tab1.xxx = "2435" and tab2.yyy = item.itenID ... "
is SQL, not Lua .

You probably don't have to change the SQL. Just the Lua function names
(e.g. "db.query()" has to be changed to something like "db.someOtherNameForQuery()").

There's also probably a document somewhere that shows which old format "db.xxx()" calls are equivalent to the new ones.
 
Last edited:
I don't have skype - but your next move is as simple as I described. Look through the scripts in your \data until you find some that make database calls, then (if you like) post the format of the different calls here.

The names will almost certainly be similar to (but not identical to):
db.query()
db.insert()
db.delete()
db.update()
etc.

BTW those names come from SQL. The most common SQL commands for this kind of thing are:
SELECT, INSERT, DELETE, UPDATE,
and people usually call read requests implemented with SQL SELECT "queries".

When you're creating tables in a database there's also
CREATE TABLE, ALTER TABLE, DROP TABLE, and a few more
but it would be very strange to find those in a runtime OT script.
OTOH if you'll find them in the SQL scripts you run to set up the database for a new server.
 
@Limos do I have to add anything to my database?

cause it gives me this error

[31/03/2014 16:44:52] mysql_real_query(): INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES ("Fire", "GOD Rewind", "Vip Medal", -1); - MYSQL ERROR: Table 'panamera.events' doesn't exist (1146)



I also get this error when saying !fire join


[31/03/2014 16:38:40] [Error - TalkAction Interface]
[31/03/2014 16:38:40] bufferonSay
[31/03/2014 16:38:40] Description:
[31/03/2014 16:38:40] (luaCreateConditionObject) This function can only be used while loading the script.

[31/03/2014 16:38:40] [Error - TalkAction Interface]
[31/03/2014 16:38:40] bufferonSay
[31/03/2014 16:38:40] Description:
[31/03/2014 16:38:40] (luaDoAddCondition) Condition not found
 
Last edited:
Add this in the config part (not inside the configFireStormEvent table).
Code:
fight = createConditionObject(CONDITION_INFIGHT)
setConditionParam(fight, CONDITION_PARAM_TICKS, -1)


Then change this
Code:
doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, -1))
To this
Code:
doAddCondition(cid, fight)



~~~~

For the missing table, run this query in your database.
Code:
CREATE TABLE `events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event_name` varchar(255) NOT NULL,
`winner_name` varchar(255) NOT NULL,
`won_item` varchar(255) NOT NULL,
`time_win` int(7) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=45 ;
 
Back
Top