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

[TFS 1.0 / 1.2] LUA Functions

carre

Intermediate OT User
Joined
Apr 23, 2013
Messages
864
Solutions
1
Reaction score
139
Location
Sweden
you can't send this message, forbidden characters can someone help me plx
 

putamerda

New Member
Joined
Jan 2, 2012
Messages
73
Reaction score
0
I dont need? can you explain me? Because im working on a system that insert a row on guild_wars table, but i used to use this functions on TFS 0.4 to start a war Ingame
 

amoeba13

New Member
Joined
Jan 7, 2011
Messages
10
Reaction score
2
You know, i need an clean map for TFS 1.0.0

Here it is:


Code:
local cd = 30 -- How long after the broadcast will the map be cleaned? in seconds
function onTime(interval)
    broadcastMessage("Game map will be cleaned in ".. cd .." seconds. Mind it may freeze.")
    addEvent(cleanMap, cd*1000)
    addEvent(broadcastMessage, cd+1*1000, "Game map cleaned.")
    return true
end
 

putamerda

New Member
Joined
Jan 2, 2012
Messages
73
Reaction score
0
Im building an system to save only 1 player theres a function like: doPlayerSave(cid)
 

putamerda

New Member
Joined
Jan 2, 2012
Messages
73
Reaction score
0
setCombatFormula with only 6 params?
What about the real tibia formulas?

setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -2, -80, -1, -90, 6, 4, 6, 5) --Sudden Death?


NVM got it...
 
Last edited:

Cornex

Web Developer
Staff member
Global Moderator
Joined
Jun 15, 2008
Messages
3,447
Solutions
5
Reaction score
1,163
Location
Sweden
Where can i read the db functions?
 

Ninja

Global Moderator
Staff member
Global Moderator
Joined
Apr 6, 2010
Messages
5,950
Solutions
34
Reaction score
1,579
Location
Sweden
Where can i read the db functions?
luascript.cpp

Code:
const luaL_Reg LuaScriptInterface::luaDatabaseTable[] = {
    {"query", LuaScriptInterface::luaDatabaseExecute},
    {"storeQuery", LuaScriptInterface::luaDatabaseStoreQuery},
    {"escapeString", LuaScriptInterface::luaDatabaseEscapeString},
    {"escapeBlob", LuaScriptInterface::luaDatabaseEscapeBlob},
    {"lastInsertId", LuaScriptInterface::luaDatabaseLastInsertId},
    {"tableExists", LuaScriptInterface::luaDatabaseTableExists},
    {nullptr, nullptr}
};
Code:
const luaL_Reg LuaScriptInterface::luaResultTable[] = {
    {"getDataInt", LuaScriptInterface::luaResultGetDataInt},
    {"getDataLong", LuaScriptInterface::luaResultGetDataLong},
    {"getDataString", LuaScriptInterface::luaResultGetDataString},
    {"getDataStream", LuaScriptInterface::luaResultGetDataStream},
    {"next", LuaScriptInterface::luaResultNext},
    {"free", LuaScriptInterface::luaResultFree},
    {nullptr, nullptr}
};
 

Zyntax

*WannaBe Scripter*
Joined
Jan 27, 2010
Messages
533
Reaction score
38
Location
Lua & XML Section
Wish doItemSetAttribute() was there! :(

It is there:

Code:
int32_t LuaScriptInterface::luaItemSetAttribute(lua_State* L)
{
   // item:setAttribute(key, value)
   itemAttrTypes attribute;
   if (isNumber(L, 2)) {
     attribute = static_cast<itemAttrTypes>(getNumber<int64_t>(L, 2));
   } else if (isString(L, 2)) {
     attribute = stringToItemAttribute(getString(L, 2));
   } else {
     attribute = ATTR_ITEM_NONE;
   }
   Item* item = getUserdata<Item>(L, 1);
   if (item) {
     if (attribute & 0x7F0013) { // All integer attributes
       item->setIntAttr(attribute, getNumber<int32_t>(L, 3));
       pushBoolean(L, true);
     } else if (attribute & 0x2C) { // All string attributes
       item->setStrAttr(attribute, getString(L, 3));
       pushBoolean(L, true);
     } else {
       pushNil(L);
     }
   } else {
     pushNil(L);
   }
   return 1;
}
 
Last edited:

Zyntax

*WannaBe Scripter*
Joined
Jan 27, 2010
Messages
533
Reaction score
38
Location
Lua & XML Section
Quick question;
How exactly do you use the method monster:addFriend(creature)?
I tried several ways now of defining "creature" with UID,CID,Name, .. nothing worked so far.
 

vingo

Active Member
Joined
Oct 27, 2012
Messages
464
Reaction score
43
I cant get peoples ips when using /info. I just get a bug about convertstringtoip
 
Top