[Mod] server guide book [serverguide]

User avatar
AiTechEye
Member
 
Posts: 531
Joined: Fri May 29, 2015 21:14

[Mod] server guide book [serverguide]

by AiTechEye » Thu Oct 08, 2015 10:09

A easy way to make your own serverguide!
All new players will get ther own books.
You can easy add / change tabs, content and the title of it.

License: CC0
Depends: default


Craft 2 sticks to make it
To show it by type /guide
/giveme serverguide:book or /giveme guide

Image
Attachments
ByAiTechEyeV2--serverguide.zip
(1.82 KiB) Downloaded 12 times
screenshot_20151008_112808.png
(251.9 KiB) Not downloaded yet
Last edited by AiTechEye on Sun Oct 29, 2017 08:08, edited 8 times in total.
 

Sokomine
Member
 
Posts: 3334
Joined: Sun Sep 09, 2012 17:31

Re: [Mod] serverguide

by Sokomine » Thu Oct 15, 2015 02:25

Nice. Let's hope players will read it!
A list of my mods can be found here.
 

twoelk
Member
 
Posts: 1134
Joined: Fri Apr 19, 2013 16:19
Location: northern Germany

Re: [Mod] serverguide

by twoelk » Mon Oct 19, 2015 19:02

Have been fiddling with this a little. I added some basic information from the wiki to the -" local serverguide_Tab_Text_4="Commands: "- tab
Code: Select all
\n\nBasic default Controls:\n- W\\, A\\, S\\, D:  move\n- Space:  jump\n- Left mouse button:  attack\\, mine blocks\\, \n     move an item stack in an inventory\n- Right mouse button:  use (e.g. open chest or furnace)\\, \n     place blocks\\, move one item or split items in an inventory\n- Shift+Right mouse button:  place blocks\n- Middle mouse button:  move 10 items in an inventory \n- Mouse wheel:  select item in the hotbar \n- 0-9:  select item in the hotbar \n- Q:  drop block\\, item or tool in hand \n- I:  open or close the inventory menu \n- T:  open the chat window \n- /:  Start issuing a server command \n- Shift:  descend on ladders or sneak\n     (walk slower\\, prevents falling off ledges)\n blahblahblub"


The first issue I have is that it is not very intuitive to generate some formated text. I copied the lines with the spaces from my experiments with the "welcome" mod from Craig's game. Also if you run Mineterst in the standard resolution you quickly run out of space in the text fields. Any scrolling planned or did I miss a setting?

There have been several approaches at a player information system such as the
welcome mod from the Craig-Server_game by CraigyDavi or the
news mod used by the MinetestForFun-Server-Game (related to the one used on the VoidPixel server?) or the
wiki mod that is used on some servers for this purpose such as, among others, some hosted by OldCoder.

It would be really cool if this would develope into an easy to configure and maintain ingame information system that would include all the functions allready called for in too many threads to list them all. Maybe you could combine forces with the other systems? Other things of interest might be the GUI from Sokomines marker mod for the areas protection mod that lists protected areas or displaying more information from the /status, /privs, /mods, F5 and other system querrying commands.

You might have to tweak the copyright notice though for this mod to be usuable on public servers
 

Sokomine
Member
 
Posts: 3334
Joined: Sun Sep 09, 2012 17:31

Re: [Mod] serverguide

by Sokomine » Fri Oct 23, 2015 04:30

twoelk wrote:Other things of interest might be the GUI from Sokomines marker mod for the areas protection mod that lists protected areas or displaying more information from the /status, /privs, /mods, F5 and other system querrying commands.

Combining all that distributed information might be very helpful. My mods usually come with a table that represents their namespace and contains all the relevant functions and data so that it ought to be relatively easy for other mods to access them. Showing the positions of travelnet stations on a map might also help.
A list of my mods can be found here.
 

User avatar
AiTechEye
Member
 
Posts: 531
Joined: Fri May 29, 2015 21:14

Re: [Mod] serverguide

by AiTechEye » Sat Oct 24, 2015 10:07

twoelk wrote:You might have to tweak the copyright notice though for this mod to be usuable on public servers


Added a clear license :-)
 

User avatar
texmex
Member
 
Posts: 590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] server guide book [serverguide]

by texmex » Wed Jul 27, 2016 17:13

Would it be possible to add inventory+ support so that the guide can be brought up with a button?
Taking a break from Minetest.
Mods Commons, Sling, hbSprint, Floodables, item_drop⑂, Telemosaic⑂, Herbs⑂.
Texturepacks Good Morning Craft
 

KCoombes
Member
 
Posts: 331
Joined: Thu Jun 11, 2015 23:19
Location: SW Florida, USA
In-game: Knatt or Rudilyn

Re: [Mod] server guide book [serverguide]

by KCoombes » Thu Jul 28, 2016 19:36

This. Is. FABULOUS! You have saved me days of formspec headaches with your simple code!
+100E
 

xisd
Member
 
Posts: 48
Joined: Sun Oct 02, 2016 22:38
GitHub: xisd

Re: [Mod] server guide book [serverguide]

by xisd » Tue Oct 04, 2016 01:19

Useful indeed !
Adding 'groups = {book=1},' when registering the tool would allow for storage in bookshelves

Code: Select all
minetest.register_tool("serverguide:book", {
   description = serverguide_Book_title,
   inventory_image = "default_book.png",
   -- Can be stored in bookshelves
   groups = {book=1},
   on_use = function(itemstack, user, pointed_thing)
   serverguide_guide(user,1)
   return itemstack


It would be great if Internationalization Lib (intllib) was supported too !
I might try to do that soon if I find the time

EDIT : I looked again and made two other minor changes
- colorized the book in yellow so it doesn't look like other books
- added an option 'add_to_inventory' at the beginning of the init.lua file and the corresponding if condition in the 'register_on_newplayer' function
( default value is minetest.setting_getbool("give_initial_stuff") so it does what is specified in minetest.conf, and can also be set to true or false to override it )
here is my complete file :
Code: Select all
-- add to inventory option
--    true     : add to new player inventory
--    false    : do not add...
--    minetest.setting_getbool("give_initial_stuff")   : depend on the give_initial_stuff option in minetest.conf

local add_to_inventory = minetest.setting_getbool("give_initial_stuff")

local serverguide_Book_title="The server guide"

local serverguide_Tab_Text_1="Server info\n Type /guide to see this"
local serverguide_Tab_Text_2="Server Rules \nNo ask for privs or admin stuff \nNo swearing or bad names (like God, fuc...)\nNo griefing\nNo bad stealing or steal people's usernames\nNo hacking\nDon't mess up with moderators or admins"
local serverguide_Tab_Text_3="Rulers info (moderator or admins)"
local serverguide_Tab_Text_4="Commands:\nSet your home with /sethome say /home to teleport back \nSee who are online /status"
local serverguide_Tab_Text_5="Help info\nHelp you self\n Only call a moderator or admin if you\n get problems that you cant fix it by own"

local serverguide_Tab_1="Server"
local serverguide_Tab_2="Rules"
local serverguide_Tab_3="Rulers"
local serverguide_Tab_4="Commands"
local serverguide_Tab_5="Help"

local function serverguide_guide(user,text_to_show)
local text=""
if text_to_show==1 then text=serverguide_Tab_Text_1 end
if text_to_show==2 then text=serverguide_Tab_Text_2 end
if text_to_show==3 then text=serverguide_Tab_Text_3 end
if text_to_show==4 then text=serverguide_Tab_Text_4 end
if text_to_show==5 then text=serverguide_Tab_Text_5 end

local form="size[8.5,9]" ..default.gui_bg..default.gui_bg_img..
   "button[0,0;1.5,1;tab1;" .. serverguide_Tab_1 .. "]" ..
   "button[1.5,0;1.5,1;tab2;" .. serverguide_Tab_2 .. "]" ..
   "button[3,0;1.5,1;tab3;" .. serverguide_Tab_3 .. "]" ..
   "button[4.5,0;1.5,1;tab4;" .. serverguide_Tab_4 .. "]" ..
   "button[6,0;1.5,1;tab5;" .. serverguide_Tab_5 .. "]" ..
   "button_exit[7.5,0; 1,1;tab6;X]" ..
   "label[0,1;"..text .."]"
minetest.show_formspec(user:get_player_name(), "serverguide",form)
end

minetest.register_on_player_receive_fields(function(player, form, pressed)
   if form=="serverguide" then
   if pressed.tab1 then serverguide_guide(player,1) end
   if pressed.tab2 then serverguide_guide(player,2) end
   if pressed.tab3 then serverguide_guide(player,3) end
   if pressed.tab4 then serverguide_guide(player,4) end
   if pressed.tab5 then serverguide_guide(player,5) end
   end
end)


minetest.register_tool("serverguide:book", {
   description = serverguide_Book_title,
   inventory_image = "default_book.png^[colorize:#ffff00:100",
   -- Can be stored in bookshelves
   groups = {book=1},
   on_use = function(itemstack, user, pointed_thing)
   serverguide_guide(user,1)
   return itemstack
   end,
on_place = function(itemstack, placer, pointed_thing)
   local pos = pointed_thing.under
   local node = minetest.get_node_or_nil(pos)
   local def = node and minetest.registered_nodes[node.name]
   if not def or not def.buildable_to then
      pos = pointed_thing.above
      node = minetest.get_node_or_nil(pos)
      def = node and minetest.registered_nodes[node.name]
      if not def or not def.buildable_to then return itemstack end
   end
   if minetest.is_protected(pos, placer:get_player_name()) then return itemstack end
   local fdir = minetest.dir_to_facedir(placer:get_look_dir())
   minetest.set_node(pos, {name = "serverguide:guide",param2 = fdir,})
   itemstack:take_item()
   return itemstack
end
})
minetest.register_alias("guide", "serverguide:book")
minetest.register_craft({output = "serverguide:book",recipe = {{"default:stick","default:stick"},}})


minetest.register_node("serverguide:guide", {
   description = serverguide_Book_title,
   drawtype = "nodebox",
   paramtype = "light",
   paramtype2 = "facedir",
   is_ground_content = false,
   drop="serverguide:book",
   node_box = {
      type = "fixed",
      fixed = {0.35,-0.3,0.45,-0.35,-0.5,-0.45},
   },
   tiles = {
   "default_gold_block.png^default_book.png",
   "default_gold_block.png",
   "default_gold_block.png",
   "default_gold_block.png",
   "default_gold_block.png",
   "default_gold_block.png",},
   groups = {cracky=1,oddly_breakable_by_hand=3},
   sounds=default.node_sound_wood_defaults(),
on_construct = function(pos)
      local meta = minetest.get_meta(pos)
      meta:set_string("infotext", serverguide_Book_title)
end,
on_rightclick = function(pos, node, clicker)
   serverguide_guide(clicker,1)
end

})


minetest.register_on_newplayer(function(player)
   if add_to_inventory then
      player:get_inventory():add_item("main", "serverguide:book")
   end
end)


minetest.register_chatcommand("guide", {
   params = "",
   description = serverguide_Book_title,
   func = function(name, param)
      serverguide_guide(minetest.get_player_by_name(name),1)
      return true
   end
})


sorry for the long post ... (that's the end of it, I promise)
 

xisd
Member
 
Posts: 48
Joined: Sun Oct 02, 2016 22:38
GitHub: xisd

Re: [Mod] server guide book [serverguide]

by xisd » Thu Oct 06, 2016 04:41

Sorry for the double post

I made a few changes to this already great mod and posted it on github
https://github.com/xisd/serverguide

Changes are :

- Add internationalization support (intllib) and french translation
- Colorize book
- Change book from tool to item and add group book so it can be placed in bookshelves
- Replace label by textarea in formspec for automatic break lines
- Add use of files for tab content
- Add option to add to inventory of new player
 

twoelk
Member
 
Posts: 1134
Joined: Fri Apr 19, 2013 16:19
Location: northern Germany

Re: [Mod] server guide book [serverguide]

by twoelk » Thu Oct 06, 2016 11:50

great stuff

wrapping works as expected. (Screen long words do not get wrapped of course)
so now for the problem of too long texts.
We will need scrolling I guess.

I also played with the language setting. It did not recognize the "local" setting of my machine but after adding a language parameter to my minetest.config it did read the new content I had created. It did not change the tab titles though that I had added a file for. Does it look up at another place for this? I also tried it with french as a file is allready supplied but that also did not change the tab headings.

It would be great if I could force a language from within the mod folder as the system language might not always be the language I want the guide to be in. Actually it would be really usefull if I could choose the language ingame, maybe with some buttons in the Help section. It would be fun to be able to write for example a latin version for educational purposes without having to set the local to latin or fiddling with the default files.

Any hope in adding at least a subset of markdown?
 

xisd
Member
 
Posts: 48
Joined: Sun Oct 02, 2016 22:38
GitHub: xisd

Re: [Mod] server guide book [serverguide]

by xisd » Fri Oct 07, 2016 17:40

I looked for a scrolling method a while ago but I never found anything, but yes that would be great
(Same for the markdown I can't see how to do that)

Language setting detection is taken from intllib : it tries first minetest.conf, then os langage, then finally default to english as last resort
Maybe it ditn't detect your os lang because you use windows? See this post

Tab titles are still defined in the init.lua file but are translated using file "locale/<two letters corresponding to your langage>.txt" by intllib mod (copy and rename the template.txt to set the content properly)
If either this intllib mod or the text file does not exist, they would not be translated

To use a custom language (for the tab content only) you could add an option as the beginning of the init.lua file (after the add_to_inventory variable for example)

Code: Select all
-- Use a custom langage folder
-- set to false to desactivate
local custom_langage = "latin"


and then adding an override of the LANG variable
it must be after the definition of the LANG and before the for loop)

Code: Select all
   
-- Overrite previous LANG definition if custom langage set
if custom_langage then LANG = custom_langage
 

Modern Hippie
Member
 
Posts: 115
Joined: Wed Oct 29, 2014 04:35

Re: [Mod] server guide book [serverguide]

by Modern Hippie » Sun Apr 16, 2017 09:08

xisd wrote:Sorry for the double post

I made a few changes to this already great mod and posted it on github
https://github.com/xisd/serverguide

Changes are :

- Add internationalization support (intllib) and french translation
- Colorize book
- Change book from tool to item and add group book so it can be placed in bookshelves
- Replace label by textarea in formspec for automatic break lines
- Add use of files for tab content
- Add option to add to inventory of new player


I tried your changed mod, but if I tried to change something in the text it didn't worked :/
No longer active with this account! Please PM me on my new account "Wolfshippie"!
 

xisd
Member
 
Posts: 48
Joined: Sun Oct 02, 2016 22:38
GitHub: xisd

Re: [Mod] server guide book [serverguide]

by xisd » Fri Oct 20, 2017 15:25

Modern Hippie wrote:I tried your changed mod, but if I tried to change something in the text it didn't worked :/


I haven't looked a it in a while but did you edit the files in the world folder ?

The ones in the mod directory are templates only used to generate the ones in the world folder (their contient is written into the world folder files if those are missing )

So normally to edit the text of tabs : either edit the files in the mod folder and delete those in the word folder
or directly edit those in the word folder
 

User avatar
AiTechEye
Member
 
Posts: 531
Joined: Fri May 29, 2015 21:14
 

User avatar
Wolfshippie
Member
 
Posts: 57
Joined: Mon Jul 24, 2017 12:37
Location: Franconia, Bavaria, Germany
GitHub: Wolfshippie
IRC: wolfshippie
In-game: wolfshippie minehippie

Re: [Mod] server guide book [serverguide]

by Wolfshippie » Sun Oct 29, 2017 17:04

xisd wrote:
Modern Hippie wrote:I tried your changed mod, but if I tried to change something in the text it didn't worked :/


I haven't looked a it in a while but did you edit the files in the world folder ?

The ones in the mod directory are templates only used to generate the ones in the world folder (their contient is written into the world folder files if those are missing )

So normally to edit the text of tabs : either edit the files in the mod folder and delete those in the word folder
or directly edit those in the word folder

Ahhh, thanks XD
My YT ║ My vid.me ║ Moderator on: Yggdrasil ( EN I GE I Telegram ) - Sky World - World of Parcours and Mazes - + 1 other server
 


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 7 guests