Module:Tips and tricks: Difference between revisions

From BTA-Mirror
imported>Ttv pedro270707
(Created page with "local p = {} -- It is possible to move this to Module:Tips and tricks/tips p.tips = { "Press R (default) to open the Guidebook.", "Portals can be as large (or small) as you want.", "Making a Nether portal requires obsidian edges.", "The trommel lets you turn useless dirt into valuable resources.", "Cherry trees bloom in spring.", "Leather boots keep your crops safe from trampling.", "Season change every 7 days.", "Items pass thro...")
imported>Ttv pedro270707
mNo edit summary
 
(20 intermediate revisions by the same user not shown)
Line 3: Line 3:
-- It is possible to move this to Module:Tips and tricks/tips
-- It is possible to move this to Module:Tips and tricks/tips
p.tips = {
p.tips = {
"Press R (default) to open the Guidebook.",
"Press <span style=\"text-decoration: underline 1px dotted; cursor: help;\" title=\"Defaults to the R key.\">guidebook</span> to open the [[guidebook]].",
"Portals can be as large (or small) as you want.",
"Portals can be as large (or small) as you want.",
"Making a Nether portal requires obsidian edges.",
"Making a Nether portal requires obsidian corners.",
"The [[Trommel|trommel]] lets you turn useless dirt into valuable resources.",
"The [[trommel]] lets you turn useless dirt into valuable resources.",
"[[Cherry tree|Cherry trees]] bloom in spring.",
"[[Cherry tree]]s bloom in spring.",
"Leather boots keep your crops safe from trampling.",
"[[Armor|Leather boots]] keep your crops safe from trampling.",
"[[Seasons]] change every 7 days.",
"[[Season]]s change every seven days.",
"Items pass through [[mesh block]]s.",
"Items pass through [[mesh block]]s.",
"[[Blast furnace]]s smelt faster than regular ones.",
"[[Blast furnace]]s smelt faster than regular ones.",
"Press {{key|noclip}} to fly in creative.",
"Press <span style=\"text-decoration: underline 1px dotted; cursor: help;\" title=\"Defaults to the left control key.\">noclip</span> to fly in Creative mode.",
"[[Moss]] spreads to nearby blocks. See what it can spread to!",
"[[Moss]] spreads to nearby blocks. See what it can spread to!",
"Use {{key|noclip}} + scroll up/down to change flying speed in creative.",
"Use <span style=\"text-decoration: underline 1px dotted; cursor: help;\" title=\"Defaults to the left control key.\">noclip</span> + scroll up/down to change flying speed in creative.",
"Sick of watching grass grow? Use bone meal on dirt.",
"Sick of watching grass grow? Use bone meal on dirt.",
"Beds need blankets! Use [[cloth]] to craft them.",
"Beds need blankets! Use [[cloth]] to craft them.",
"Quivers provide a convenient way to store a lot of arrows.",
"[[Quiver]]s provide a convenient way to store a lot of arrows.",
"[[Olivine]] is a decent substitute for [[Nether coal]].",
"[[Olivine]] is a decent substitute for [[Nether coal]].",
"Outback soil is rich with minerals.",
"Outback soil is rich with minerals.",
"There are 4 types of rock! See which one you like best.",
"There are four types of rock! See which one you like best.",
"Fancy a splash of color? Try painting wooden planks!",
"Fancy a splash of color? Try painting [[Planks|wooden planks]]!",
"Fill the Guidebook by collecting resources. Gotta craft 'em all!"
"Fill the [[guidebook]] by collecting resources. Gotta craft 'em all!"
}
}


Line 30: Line 30:
end
end


function p.getTipList( amount )
function p.getTipList( f )
local args = f
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
else
f = mw.getCurrentFrame()
end
local list = mw.html.create( 'ul' )
local list = mw.html.create( 'ul' )
for i = 1, amount do
for i = 1, args.amount do
local tip = mw.html.create( 'li' )
local tip = mw.html.create( 'li' )
tip:wikitext( p.getRandomTip( i ) )
tip:wikitext( p.getRandomTip( i ) )

Latest revision as of 16:36, 31 August 2023

Documentation for this module may be created at Module:Tips and tricks/doc

local p = {}

-- It is possible to move this to Module:Tips and tricks/tips
p.tips = {
	"Press <span style=\"text-decoration: underline 1px dotted; cursor: help;\" title=\"Defaults to the R key.\">guidebook</span> to open the [[guidebook]].",
	"Portals can be as large (or small) as you want.",
	"Making a Nether portal requires obsidian corners.",
	"The [[trommel]] lets you turn useless dirt into valuable resources.",
	"[[Cherry tree]]s bloom in spring.",
	"[[Armor|Leather boots]] keep your crops safe from trampling.",
	"[[Season]]s change every seven days.",
	"Items pass through [[mesh block]]s.",
	"[[Blast furnace]]s smelt faster than regular ones.",
	"Press <span style=\"text-decoration: underline 1px dotted; cursor: help;\" title=\"Defaults to the left control key.\">noclip</span> to fly in Creative mode.",
	"[[Moss]] spreads to nearby blocks. See what it can spread to!",
	"Use <span style=\"text-decoration: underline 1px dotted; cursor: help;\" title=\"Defaults to the left control key.\">noclip</span> + scroll up/down to change flying speed in creative.",
	"Sick of watching grass grow? Use bone meal on dirt.",
	"Beds need blankets! Use [[cloth]] to craft them.",
	"[[Quiver]]s provide a convenient way to store a lot of arrows.",
	"[[Olivine]] is a decent substitute for [[Nether coal]].",
	"Outback soil is rich with minerals.",
	"There are four types of rock! See which one you like best.",
	"Fancy a splash of color? Try painting [[Planks|wooden planks]]!",
	"Fill the [[guidebook]] by collecting resources. Gotta craft 'em all!"
}

function p.getRandomTip( i )
	math.randomseed(os.time() + i)
	return p.tips[math.random(#p.tips)]
end

function p.getTipList( f )
	local args = f
	if f == mw.getCurrentFrame() then 
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		f = mw.getCurrentFrame()
	end
	
	local list = mw.html.create( 'ul' )
	for i = 1, args.amount do
		local tip = mw.html.create( 'li' )
		tip:wikitext( p.getRandomTip( i ) )
		list:node( tip )
	end
	
	return tostring( list )
end

return p