0gb_us is actually working on a better solution that requires in-game experience, but no actual items. Anyway, 0gb_us's new in-progress private warp points mod will supersede this.Chinchow wrote:Steel ingots!?
You monster!
What's next losing 99 coal?
Why not take mese?
jojoa1997 wrote:could you add the ability to delete bookmarks. i have set it where i dont need anything to get bookmarks but i also cant delete them
Chinchow wrote:Steel ingots!?
You monster!
What's next losing 99 coal?
Why not take mese?
rarkenin wrote:0gb_us is actually working on a better solution that requires in-game experience, but no actual items. Anyway, 0gb_us's new in-progress private warp points mod will supersede this.Chinchow wrote:Steel ingots!?
You monster!
What's next losing 99 coal?
Why not take mese?
jojoa1997 wrote:could you make another mod which is a version of this that doesn't need to cost anything and you can delete them. like the one on your server but for singleplayer. or you could check to see if it is being used on a server and have it switch over to server mod.
local filename = minetest.get_worldpath().."/bookmarks.0gb.us"
local logfilename = minetest.get_worldpath().."/log.bookmarks.0gb.us"
local bookmarks = {}
local page = {""}
local playerpage = {}
local function ceil(pos)
local x = math.ceil(pos.x)
local y = math.ceil(pos.y)
local z = math.ceil(pos.z)
return {x=x,y=y,z=z}
end
local function build_pages()
local x = 0
local y = 6
local z = 0
for key, value in pairs(bookmarks) do
if y == 6 then
y = 0
z = z + 1
page[z] = ""
end
page[z] = page[z].."button["..x..".5,"..y..";3,1;bookmark.bookmarks.0gb.us;"..key.."]"
x = x + 3
if x == 12 then
x = 0
y = y + 1
end
end
end
local function load()
local file = io.open(filename, "r")
if file then
for line in file:lines() do
if line ~= "" then
local space = line:find(" ", 1, true)
local key = line:sub(1, space-1)
local value = line:sub(space+1)
bookmarks[key] = minetest.string_to_pos(value)
end
end
file:close()
build_pages()
end
end
local function save()
local file = io.open(filename, "w")
for k,v in pairs(bookmarks) do
file:write(k.." "..minetest.pos_to_string(v).."\n")
end
file:close()
end
local function delete_bookmark(bookmark)
local file = io.open(filename, "w")
for k,v in pairs(bookmarks) do
if k == bookmark then
-- no nothing (del) element
else
file:write(k.." "..minetest.pos_to_string(v).."\n")
end
end
file:close()
end
local function log(user, bookmark)
local file = io.open(logfilename, "a")
file:write("user:",user," bookmark:",bookmark,"\n")
file:close()
end
minetest.register_on_joinplayer(function(player)
inventory_plus.register_button(player, "go.bookmarks.0gb.us", "Bookmarks")
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if fields["go.bookmarks.0gb.us"] or fields["bookmark.bookmarks.0gb.us"] then
if fields["bookmark.bookmarks.0gb.us"] then
player:setpos(bookmarks[fields["bookmark.bookmarks.0gb.us"]])
--minetest.chat_send_player(name, "Teleporting to "..fields["bookmark.bookmarks.0gb.us"])
end
if not playerpage[name] then
playerpage[name] = 1
elseif fields["go.bookmarks.0gb.us"] == "<<" then
playerpage[name] = ((playerpage[name] - 2) % #page) +1
elseif fields["go.bookmarks.0gb.us"] == ">>" then
playerpage[name] = (playerpage[name] % #page) + 1
end
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"button[0.5,6.5;3,1;main;main menu]"..
"button[3.6,6.5;1,1;go.bookmarks.0gb.us;<<]"..
"button[4.8,6.5;1,1;go.bookmarks.0gb.us;>>]"..
"button[6.1,6.5;3,1;set.bookmarks.0gb.us;Set Bookmark]"..
"button[9.1,6.5;3,1;del.bookmarks.0gb.us;Del Bookmark]"..
page[playerpage[name]]
)
elseif fields["del.bookmarks.0gb.us"] then
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"field[8.3,3;4,1;name.bookmarks.0gb.us;Bookmark Name:;]"..
"button[8,3.5;4,1;del.bookmarks.0gb.us;Del Bookmark]"..
"button[0.5,6.5;3,1;main;main menu]"..
"button[9.1,6.5;3,1;go.bookmarks.0gb.us;Back to Bookmarks]"
)
if fields["name.bookmarks.0gb.us"] then
if not string.find(fields["name.bookmarks.0gb.us"], "^[%w_%-]+$") then
--minetest.chat_send_player(name, "The chosen bookmark name contains invalid characters, or is blank.")
--elseif bookmarks[fields["name.bookmarks.0gb.us"]] then
-- minetest.chat_send_player(name, "The chosen bookmark name is already in use.")
elseif fields["name.bookmarks.0gb.us"]:len() > 19 then
--minetest.chat_send_player(name, "The bookmark name may have no more than nineteen characters.")
else
-- delete bookmark
delete_bookmark(fields["name.bookmarks.0gb.us"])
--minetest.chat_send_player(name, "Bookmark deleted: "..fields["name.bookmarks.0gb.us"])
bookmarks = {}
load()
log(name, fields["name.bookmarks.0gb.us"].." deleted")
end
end
elseif fields["set.bookmarks.0gb.us"] then
inventory_plus.set_inventory_formspec(player,
"size[13,7.5]"..
"field[8.3,3;4,1;name.bookmarks.0gb.us;Bookmark Name:;]"..
"button[8,3.5;4,1;set.bookmarks.0gb.us;Set Bookmark]"..
"button[0.5,6.5;3,1;main;main menu]"..
"button[9.1,6.5;3,1;go.bookmarks.0gb.us;Back to Bookmarks]"
)
if fields["name.bookmarks.0gb.us"] then
if not string.find(fields["name.bookmarks.0gb.us"], "^[%w_%-]+$") then
--minetest.chat_send_player(name, "The chosen bookmark name contains invalid characters, or is blank.")
--elseif bookmarks[fields["name.bookmarks.0gb.us"]] then
-- minetest.chat_send_player(name, "The chosen bookmark name is already in use.")
elseif fields["name.bookmarks.0gb.us"]:len() > 19 then
--minetest.chat_send_player(name, "The bookmark name may have no more than nineteen characters.")
else
local inv = player:get_inventory()
local pos = player:getpos()
bookmarks[fields["name.bookmarks.0gb.us"]] = ceil(pos)
save()
--minetest.chat_send_player(name, "Bookmark created: "..fields["name.bookmarks.0gb.us"])
build_pages()
log(name, fields["name.bookmarks.0gb.us"].." created")
end
end
end
end)
minetest.register_chatcommand("goto", {
params = "<bookmark>",
description = "warps you to a bookmarked location",
privs = {},
func = function(name, param)
if bookmarks[param] then
local player = minetest.env:get_player_by_name(name)
player:setpos(bookmarks[param])
else
minetest.chat_send_player(name, "No bookmark by that name exists.")
end
end
})
load()
cHyper wrote:a delete function for bookmarks for your singleplayer-map....
replace the code in the init.lua file of the bookmark-mod...
DO NOT USE IT FOR YOUR SERVER...
jojoa1997 wrote:cHyper wrote:a delete function for bookmarks for your singleplayer-map....
replace the code in the init.lua file of the bookmark-mod...
DO NOT USE IT FOR YOUR SERVER...
thank you so much. now it is awesome.
cHyper wrote:jojoa1997 wrote:cHyper wrote:a delete function for bookmarks for your singleplayer-map....
replace the code in the init.lua file of the bookmark-mod...
DO NOT USE IT FOR YOUR SERVER...
thank you so much. now it is awesome.
u can set bookmarks as many as u like... u dont need any ingots for it...
u can update bookmarks by set it with the same bookmark-name...
jojoa1997 wrote:Never mind i found out the problem. I had a space so i guess the mod can't read spaces.
Old Post:for some reason i have tested it more now and the bookmarks wont set
jojoa1997 wrote:i thought you use a warp mod not this one. also the name was "cubby hole" but when i renamed it to "cubby_hole" it worked. also if you do make it windows incompatible then keep a working "Old" download in the topic so other windows users can use it.
terminalerror wrote:Maybe you can make the cost of iron increasingly higher. For example, the first bookmark (usually one's house) can be cheap...say, around 10 iron at worst. For the next couple bookmarks, the price could rise to 20, 30, 50, etc. until the 99 mark is reached. From there, the price will remain at 99 steel ingots per bookmark. I don't know how you could implement this, though. Just my two cents.
jojoa1997 wrote:why not have 2 lists. a public and a private. it would cost 10 steel for the private but if you want to showcase something you would have to make a 99 steel payment to get on the public list.
I didn't think it was like the one on our server. If you could find a way to add a private list with a delete button then that would be awesome. I think you should not have deleting cost anything since you would be losing 10 steel. I y hope this can work out :-)0gb.us wrote:jojoa1997 wrote:why not have 2 lists. a public and a private. it would cost 10 steel for the private but if you want to showcase something you would have to make a 99 steel payment to get on the public list.
Sounds good. Also sounds like two separate plugins, such as this one and the one we use on our server.
jojoa1997 wrote:I didn't think it was like the one on our server. If you could find a way to add a private list with a delete button then that would be awesome. I think you should not have deleting cost anything since you would be losing 10 steel. I y hope this can work out :-)0gb.us wrote:jojoa1997 wrote:why not have 2 lists. a public and a private. it would cost 10 steel for the private but if you want to showcase something you would have to make a 99 steel payment to get on the public list.
Sounds good. Also sounds like two separate plugins, such as this one and the one we use on our server.
jojoa1997 wrote:ok then set a price
Users browsing this forum: No registered users and 15 guests