• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Minimap locations

Code:
[COLOR=#aa9900][B]for[/B][/COLOR] i [COLOR=#66cc66]=[/COLOR] [COLOR=#cc66cc]1[/COLOR][COLOR=#66cc66],[/COLOR] [COLOR=#66cc66]#[/COLOR]mark [COLOR=#aa9900][B]do[/B][/COLOR]

might want to fix that, Lua being case-sensitive and all.

And let me say this, nothing beats lots of trial and error and time for learning, but the best reference supplement I've ever seen is Programming In Lua 2nd Ed. And I do mean, in no uncertain terms, very specifically the second edition. I'm sure that this will totally be lost and someone will point out the PIL 1st Ed. online like an immortal master of oblivious, so let's just be blatant and state here that this is NOT a suitable alternative for PIL2e.
 
Links like that PIL2e thing should be posted and stickied somewhere.

ON TOPIC:
Awesome script dude! I'm also getting into coding some things myself as a first timer in lua (learning). I took classes in school for c++, basic, visual-basic.. etc. But it's been a while.

Good luck on your future scripts I'm also going to be releasing scripts that I make =).
 
someboy can help me?

[26/10/2012 21:56:25] data/actions/scripts/loc.lua:eek:nUse
[26/10/2012 21:56:25] Description:
[26/10/2012 21:56:25] data/actions/scripts/loc.lua:15: attempt to call global 'doPlayerAddMark' (a nil value)
[26/10/2012 21:56:25] stack traceback:
[26/10/2012 21:56:25] data/actions/scripts/loc.lua:15: in function <data/actions/scripts/loc.lua:1>

thx
 
someboy can help me?

[26/10/2012 21:56:25] data/actions/scripts/loc.lua:eek:nUse
[26/10/2012 21:56:25] Description:
[26/10/2012 21:56:25] data/actions/scripts/loc.lua:15: attempt to call global 'doPlayerAddMark' (a nil value)
[26/10/2012 21:56:25] stack traceback:
[26/10/2012 21:56:25] data/actions/scripts/loc.lua:15: in function <data/actions/scripts/loc.lua:1>

thx

What server are you using? It's obviously not recognizing doPlayerAddMark as a function.
 
otx version 2.2

Never heard of it. But a quick google shows it exists, and that it does have this function, however that's branch 0.3

My suggestion is donate and upgrade to TFS, from what I keep hearing OTX is just a ripoff anyways.
 
Thanks lessaire for the support you have been giving to people !I will continue lua soon :) just abit occupied with the art/mapping side atm ^^
 
bumping this because getting back into scripting and well, it needs a bump? :>
 
Bumping - making a duel script also..
Perhaps for rpg servers w/o pvp players can !duel "playername.
Gonna take a while since im busy around it but meh.. Wont be too long i guess
 
You could probably edit it like this in order to make it compatible to both 0.2 and 0.3.
Also, you should use constants instead of 21 in text message.

Lua:
 --[[ Script by Ghostx... 
    Use a map recieve map marks/locations on minimap
    Any issues and/or questions do contact me on otland.
]]--

local marks = {
    [1]={{x=0000,y=0000,z=7}, "name", MAPMARK_TEMPLE}, -- Edit the locations to the position to mark
    [2]={{x=0000,y=0000,z=7}, "name", MAPMARK_LOCK}, -- Where it says 'name' change it to the place
    [3]={{x=0000,y=0000,z=7}, "name", MAPMARK_SWORD}, -- You can change the icon after the mapmark_
    [4]={{x=0000,y=0000,z=7}, "name", MAPMARK_STAR}, -- You can add or reduce locations just by
    [5]={{x=0000,y=0000,z=7}, "name", MAPMARK_FLAG}, -- adding/deleteing a line
    [6]={{x=0000,y=0000,z=7}, "name", MAPMARK_TICK}, -- Make sure to follow the [1], [2] order rule.
    [7]={{x=0000,y=0000,z=7}, "name", MAPMARK_REDWEST},
    [8]={{x=0000,y=0000,z=7}, "name", MAPMARK_BAG}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i = 1, #marks do
        if doAddMapMark then
            doAddMapMark(cid, marks[i][1], marks[i][3], marks[i][2])
        else
            doPlayerAddMark(cid, marks[i][1], marks[i][3], marks[i][2]) 
        end
    end
    doPlayerSendTextMessage(cid, 21, "You now have locations marked on your map")
    return true
end
 
I love this script! It will help the noobies in my server alot :)

But I'm running into a problem, I can't seem to change the kind of icon it places on the map. It keeps making the first one, the green checkmark.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doAddMapMark(cid, {x=1058,y=992,z=7},"Temple",MAPMARK_SWORD)
doPlayerSendTextMessage(cid, 21, "You now have locations marked on your map")
return true
end

I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

Any fixes are welcome :)
Thanks in advance.
 
You can find the functions in luascript.cpp.
Code:
doAddMapMark(cid, pos, type, description)
Switch "Temple" with MAPMARK_SWORD and add this to global.lua.
Code:
MAPMARK_TICK = 0
MAPMARK_QUESTION = 1
MAPMARK_EXCLAMATION = 2
MAPMARK_STAR = 3
MAPMARK_CROSS = 4
MAPMARK_TEMPLE = 5
MAPMARK_KISS = 6
MAPMARK_SHOVEL = 7
MAPMARK_SWORD = 8
MAPMARK_FLAG = 9
MAPMARK_LOCK = 10
MAPMARK_BAG = 11
MAPMARK_SKULL = 12
MAPMARK_DOLLAR = 13
MAPMARK_REDNORTH = 14
MAPMARK_REDSOUTH = 15
MAPMARK_REDEAST = 16
MAPMARK_REDWEST = 17
MAPMARK_GREENNORTH = 18
MAPMARK_GREENSOUTH = 19
 
tfs 1.1

I got debug.

I did this:
Code:
    <action uniqueid="22010" script="mapmark.lua"/>
in actions.xml

and mapmark.lua:
Code:
local marks = {
[1]={{x=2521,y=2531,z=7}, "Morgan's Shop", MAPMARK_SHOVEL}, -- Edit the locations to the position to mark
[2]={{x=2503,y=2538,z=7}, "Philippe's Shop", MAPMARK_SWORD}, -- Where it says 'name' change it to the place
[3]={{x=2515,y=2515,z=7}, "Grapes farm", MAPMARK_STAR}, -- You can change the icon after the mapmark_
[4]={{x=2504,y=2515,z=7}, "Temple in Dorav", MAPMARK_TEMPLE}, -- You can add or reduce locations just by
[5]={{x=2486,y=2520,z=7}, "Hunters", MAPMARK_BAG}, -- adding/deleteing a line
[6]={{x=2551,y=2523,z=7}, "Windmill", MAPMARK_STAR} -- Make sure to follow the [1], [2] order rule.
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
for i = 1, #marks do
if doAddMapMark then
doAddMapMark(cid, marks[1], marks[3], marks[2])
else
doPlayerAddMark(cid, marks[1], marks[3], marks[2])
end
end
doPlayerSendTextMessage(cid, 21, "You have updated your map!")
return true
end

I set unique id 22010 to item 5658 on map. When I do right click I'm getting debug:

K3tosk8.png

GRSp4ag.png


Same for actionid.

@Limos
@GhostX
 
Last edited:
Code:
doPlayerSendTextMessage(cid, 21, "You have updated your map!")
Change 21 to one of these.
Code:
MESSAGE_STATUS_CONSOLE_RED
MESSAGE_EVENT_ORANGE
MESSAGE_STATUS_CONSOLE_ORANGE
MESSAGE_STATUS_WARNING
MESSAGE_EVENT_ADVANCE
MESSAGE_EVENT_DEFAULT
MESSAGE_STATUS_DEFAULT
MESSAGE_INFO_DESCR
MESSAGE_STATUS_SMALL
MESSAGE_STATUS_CONSOLE_BLUE
 
Code:
doPlayerSendTextMessage(cid, 21, "You have updated your map!")
Change 21 to one of these.
Code:
MESSAGE_STATUS_CONSOLE_RED
MESSAGE_EVENT_ORANGE
MESSAGE_STATUS_CONSOLE_ORANGE
MESSAGE_STATUS_WARNING
MESSAGE_EVENT_ADVANCE
MESSAGE_EVENT_DEFAULT
MESSAGE_STATUS_DEFAULT
MESSAGE_INFO_DESCR
MESSAGE_STATUS_SMALL
MESSAGE_STATUS_CONSOLE_BLUE
Still debug :(

@Limos
Thank you very much! Now it works!
 
Last edited:
Code:
doAddMapMark(cid, marks[i][1], marks[i][3], marks[i][2])
 
I'll edit that into first post :> cheers

My TFS is 1.0, and I can't run it. Can you help me?

Lua Script Error: [Action Interface]
data/actions/scripts/other/minimapmarks.lua:eek:nUse
data/actions/scripts/other/minimapmarks.lua:16: attempt to get length of global
'mark' (a nil value)
stack traceback:
[C]: in function '__len'
data/actions/scripts/other/minimapmarks.lua:16: in function <data/action
s/scripts/other/minimapmarks.lua:5>

--[[ Script by Ghostx...
Use a map recieve map marks/locations on minimap
Any issues and/or questions do contact me on otland.
]]--
function onUse(cid, item, fromPosition, itemEx, toPosition)

local Mark = {
[1]={{x=100,y=45,z=6},"Templo",MAPMARK_TEMPLE}, -- Edit the locations to the position to mark
[2]={{x=100,y=68,z=6},"name",MAPMARK_BAG}, -- Where it says 'name' change it to the place
[3]={{x=80,y=79,z=6},"name",MAPMARK_DOLLAR}, -- You can change the icon after the mapmark_
[4]={{x=39,y=102,z=6},"name",MAPMARK_SWORD}, -- You can add or reduce locations just by
[5]={{x=83,y=43,z=6},"name",MAPMARK_FLAG} -- adding/deleteing a line
-- Make sure to follow the [1], [2] order rule.

}
for i = 1, #mark do
doPlayerAddMark(cid, Mark[1], Mark[3], Mark[2])
end
doPlayerSendTextMessage(cid, 21, "You now have locations marked on your map")
return true
end

<action actionid="5000" script="other/minimapmarks.lua"/>
 
Change mark to Mark, you also have to add the [ i].
Code:
doAddMapMark(cid, Mark[i][1], Mark[i][3], Mark[i][2])
And change the 21 in the textmessage.
 
Back
Top