[Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
- Wuzzy
- Member
- Posts: 4900
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
OK, now that PR 535 was merged, this follow-up PR is now ready:
https://github.com/minetest-mods/mesecons/pull/635
This is the ACTUAL meat of it all. This PR will add tons of new noteblock instruments, as announced previously.
https://github.com/minetest-mods/mesecons/pull/635
This is the ACTUAL meat of it all. This PR will add tons of new noteblock instruments, as announced previously.
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Hey ho,
I want to use a command block to replace an existing block with an "air block".
place x y z air
does not work.
Any suggestions?
Is there a list with all command block commands?
I want to use a command block to replace an existing block with an "air block".
place x y z air
does not work.
Any suggestions?
Is there a list with all command block commands?
- Desour
- Member
- Posts: 1518
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
The command block can only execute chatcommands. See `/help` for available ones.
(If you want to set a node somewhere, you'll need some mod that registers this chatcommand.)
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
-- deleted --
Last edited by mmmsued on Fri Jun 23, 2023 08:20, edited 1 time in total.
Some educational material (german): multimediamobile.de and minetest-modding.weebly.com
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Try this in a command block
Code: Select all
/fixedpos set1 0 0 0
/fixedpos set2 0 0 0
/set air
/unmark
Some educational material (german): multimediamobile.de and minetest-modding.weebly.com
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Updated blinker.
https://github.com/Ghaydn/misc_minetest ... r_mega.lua
This script can now be used in lua tubes and do simple sorting by item names. For more complex sorting you may want to mix it with sorter functions: https://github.com/Ghaydn/misc_minetest ... r_mega.lua
As in old version, you need to configure blink rate, port sequence, pins (switch, detector, killswitch) and wait-before-turn-off time before use; list of sorted items is in the header too.
https://github.com/Ghaydn/misc_minetest ... r_mega.lua
This script can now be used in lua tubes and do simple sorting by item names. For more complex sorting you may want to mix it with sorter functions: https://github.com/Ghaydn/misc_minetest ... r_mega.lua
As in old version, you need to configure blink rate, port sequence, pins (switch, detector, killswitch) and wait-before-turn-off time before use; list of sorted items is in the header too.
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Hi,
is there a way to access node position inside a luacontroller? I want to do something like that:
are there "environment variables" which I can read from the cose?
thanks
is there a way to access node position inside a luacontroller? I want to do something like that:
Code: Select all
if (event.type=="on") then
digiline_send("channel", pos)
end
thanks
- Blockhead
- Moderator
- Posts: 2096
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
The Luacontroller is a digital device with Mesecons and Digilines connections, but no sensors or environment info like that. You would need an external component to signal that kind of info across a digiline.elettrico wrote: ↑Sun Feb 18, 2024 18:02Hi,
is there a way to access node position inside a luacontroller? I want to do something like that:are there "environment variables" which I can read from the cose?Code: Select all
if (event.type=="on") then digiline_send("channel", pos) end
thanks
P.S. if you haven't already, read the tutorial at mesecons.net/luacontroller.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
I currently ran into a very dumb problem. I'm trying to calculate datetimes on luacontroller and... can't.
What I'm trying to do is: take a date (local date = os.datetable()), add N days to it and show new date on a LCD. Looks simple, but it's not. I can convert datetable into seconds, then add N*60*60*24 to it and then... well, I could write some overcomplicated calendar algorithm to convert it back to datetable. But is there any simpler, cleaner way?
What I'm trying to do is: take a date (local date = os.datetable()), add N days to it and show new date on a LCD. Looks simple, but it's not. I can convert datetable into seconds, then add N*60*60*24 to it and then... well, I could write some overcomplicated calendar algorithm to convert it back to datetable. But is there any simpler, cleaner way?
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?
- Blockhead
- Moderator
- Posts: 2096
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Basically you do need the calendar info in your program. It's not directly for your application, but I have a lot of the relevant code I think you'll need, and some you won't.Ghaydn wrote: ↑Sat May 11, 2024 19:56I currently ran into a very dumb problem. I'm trying to calculate datetimes on luacontroller and... can't.
What I'm trying to do is: take a date (local date = os.datetable()), add N days to it and show new date on a LCD. Looks simple, but it's not. I can convert datetable into seconds, then add N*60*60*24 to it and then... well, I could write some overcomplicated calendar algorithm to convert it back to datetable. But is there any simpler, cleaner way?
The follow is a program that has been deployed and working well for multiple years at my house on LinuxForks server which shows the Sydney/Melbourne/Canberra timezone (AEST/AEDT depending on time of year) on a server set to CET, which accounts for and removes DST on the server, calculates the DST changeover date in Australia for the current year, and then displays the date.
You won't need the function firstXdayOfMonth and probably not the timezone or DST logic, but it does have code for the leap year calculation; rolling over to the next day, month and/or year when Australia is ahead of the server timezone; and displaying the date table in ISO 8601 format to a digiline LCD or textline; which are the kind of things you will need for your future date.
Licence: Public Domain
Code: Select all
-- d = day of week (0 = saturday, 6 = friday)
-- m = month (3 = Mar, 13 = Jan, 14 = Feb; Jan and Feb are of previous year)
-- y = year
function firstXdayOfMonth(d, m, y)
if (m == 1) then
m = 13
y = y - 1
elseif (m == 2) then
m = 14
y = y - 1
end
local K = y % 100
local J = math.floor(y/100)
-- Zeller's congruence, solved for day of month
local r = math.floor((13*(m+1))/5) + K + math.floor(K/4) + math.floor(J/4) - (2*J)
r = r % 7
if (r > d) then
return 7 + 1 - r
elseif (r == d) then
return 7
else
return (7 + d - r) % 7
end
end
function leapYear(y)
if (y % 4 == 0 and y % 100 ~= 0) then
return true
elseif (y % 400 == 0) then
return true
else
return false
end
end
-- y = year, m = month of year, d = day of month
function date2yday(y, m, d)
if (m == 1) then return d end
local day = 0
if leapYear(y) then
mem.monthlengths[2] = 29
else
mem.monthlengths[2] = 28
end
for month=1,m-1 do
day = day + mem.monthlengths[month]
end
day = day + d
return day
end
--[[ Calculate whether Australia is observing DST at a given day of a given year
at a given hour. Use the helper date2yday if you do not have the day of
year available. --]]
function isAusDST(year, yday, hour)
local finDate = mem.dstChangeovers[tostring(mem.dt.year) .. "e"]
if finDate == nil then
mem.dstChangeovers[tostring(mem.dt.year) .. "e"]
= date2yday(mem.dt.year, mem.APRIL, firstXdayOfMonth(mem.SUNDAY, mem.APRIL, mem.dt.year))
finDate = mem.dstChangeovers[tostring(mem.dt.year) .. "e"]
end
local startDate = mem.dstChangeovers[tostring(mem.dt.year) .. "b"]
if startDate == nil then
mem.dstChangeovers[tostring(mem.dt.year) .. "b"]
= date2yday(mem.dt.year, mem.OCTOBER, firstXdayOfMonth(mem.SUNDAY, mem.OCTOBER, mem.dt.year))
startDate = mem.dstChangeovers[tostring(mem.dt.year) .. "b"]
end
if yday < finDate or yday > startDate then
return true
elseif yday == finDate then
return (not (hour >= 3))
elseif yday == startDate then
return hour >= 3
else
return false
end
end
mem.dt = os.datetable()
if event.type == "program" then
mem.SUNDAY = 1
mem.APRIL = 4
mem.OCTOBER = 10
mem.monthlengths = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
mem.dstChangeovers = {}
mem.dstChangeovers[tostring(mem.dt.year) .. "e"]
= date2yday(mem.dt.year, mem.APRIL, firstXdayOfMonth(mem.SUNDAY, mem.APRIL, mem.dt.year))
mem.dstChangeovers[tostring(mem.dt.year) .. "b"]
= date2yday(mem.dt.year, mem.OCTOBER, firstXdayOfMonth(mem.SUNDAY, mem.OCTOBER, mem.dt.year))
return
end
mem.dt.hour = mem.dt.hour + 10 -- assume server in CET
if mem.dt.isdst then
mem.dt.hour = mem.dt.hour - 2
else
mem.dt.hour = mem.dt.hour - 1
end
mem.dt.isdst = isAusDST(mem.dt.year, mem.dt.yday, mem.dt.hour)
if mem.dt.isdst then
mem.dt.hour = mem.dt.hour + 1
end
if (mem.dt.hour > 23) then
mem.dt.hour = mem.dt.hour % 24
mem.dt.day = mem.dt.day + 1
if (mem.dt.month ~= 2) then
mem.monthdays = mem.monthlengths[mem.dt.month]
else
if mem.dt.year % 4 == 0 and mem.dt.year % 100 ~= 0 or mem.dt.year % 400 == 0 then
mem.monthdays = 29
else
mem.monthdays = 28
end
end
if (mem.dt.day > mem.monthdays) then
mem.dt.month = mem.dt.month + 1
mem.dt.day = 1
if (mem.dt.month > 12) then
mem.dt.year = mem.dt.year + 1
mem.dt.month = 1
end
end
end
mem.dt.tzname = "AE"
if (mem.dt.isdst) then
mem.dt.tzname = mem.dt.tzname .. "D"
else
mem.dt.tzname = mem.dt.tzname .. "S"
end
mem.dt.tzname = mem.dt.tzname .. "T"
mem.datetime = string.format("%04d-%02d-%02dT%02d:%02d", mem.dt.year, mem.dt.month, mem.dt.day, mem.dt.hour, mem.dt.min)
digiline_send("datetime",
"Sydney/Melbourne/\n" ..
"Canberra \n" ..
mem.dt.tzname .. "\n" ..
mem.datetime
)
interrupt(10)
- Attachments
-
- aus_east_time_clock.png (91.37 KiB) Viewed 2897 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Well, that's exactly the complicated way i'm afraid of.
What I'm making is a transport card system, that I'm planning to use with hyperloop. And these cards are of two types: with limited number of rides and limited time. And for the second type I needed to somehow show card's's expiration date.
But recently I came up with simpler idea: just show amount of time left, i.e. instead of "expires may 20, 2024" show just "expires in 3 days". With this approach I don't need all that date calculation stuff.
Anyways, something like this definitely should be added into luacontroller mod:
Code: Select all
local function safe_date_convert(sec)
if type(sec) == "number" and math.floor(sec) == sec then
return os.date("*t", sec)
end
return {}
end
...
os = {
...
sec_to_datetable = safe_date_convert
...
}
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Hey, does anybody know how to combinate delayers and mese torches?
/me can't speak much english
- Hybrid Dog
- Member
- Posts: 2850
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
:]
/me can't speak much english
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
After downloading the latest update to this mod on 10/16/24, the mod is crashing the game with the following error:
ModError: Runtime error from mod 'mesecons_doors' in callback on_mods_loaded(): ...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:135: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:135: in function <...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:134>
...t 5.4.1 -win64\minetest\bin\..\builtin\game\register.lua:431: in function <...t 5.4.1 -win64\minetest\bin\..\builtin\game\register.lua:417>
ModError: Runtime error from mod 'mesecons_doors' in callback on_mods_loaded(): ...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:135: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:135: in function <...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:134>
...t 5.4.1 -win64\minetest\bin\..\builtin\game\register.lua:431: in function <...t 5.4.1 -win64\minetest\bin\..\builtin\game\register.lua:417>
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Thanks for reporting!Fauxtonic wrote: ↑Wed Oct 16, 2024 19:01After downloading the latest update to this mod on 10/16/24, the mod is crashing the game with the following error:
ModError: Runtime error from mod 'mesecons_doors' in callback on_mods_loaded(): ...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:135: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:135: in function <...64\minetest\bin\..\mods\mesecons\mesecons_doors\init.lua:134>
...t 5.4.1 -win64\minetest\bin\..\builtin\game\register.lua:431: in function <...t 5.4.1 -win64\minetest\bin\..\builtin\game\register.lua:417>
This doesn't happen with an up-to-date copy of minetest_game, at least on my machine. Do you use another game or mods which might override the minetest_game `doors` API? Feel free to post a list of all mods you're currently using.
GitHub Issue: https://github.com/minetest-mods/mesecons/issues/684
- Krock
- Developer
- Posts: 4682
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
Your backtrace does not make sense. Here's the relevant code: https://github.com/minetest/minetest/bl ... #L417-L431
Your builtin directory might be outdated. Please install Minetest 5.4.1 to a new location and retry or install Minetest 5.9.1 (the most recent stable build) and retry.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
-
- Member
- Posts: 19
- Joined: Sat Jul 06, 2024 17:34
- In-game: NicoKaiser
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
how can I round in the Lua controller?
- Blockhead
- Moderator
- Posts: 2096
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
You have a lot (but not all) of Lua's standard library available in the Luacontroller. The math.* functions available to Luacontorller include math.floor and math.ceil, which always round down and up respectively. I don't know why, but stock Lua doesn't include a "normal" rounding function that rounds upwards from 0.5. However, it's included in the main core (minetest) table as math.round, so that should probably be added to Luacontrollers if you ask me.
The usual solution for implementing round on your own in Lua is to add or subtract 0.5, then use floor or ceiling - see StackOverflow.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
-
- Member
- Posts: 19
- Joined: Sat Jul 06, 2024 17:34
- In-game: NicoKaiser
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
And what is the code from the card reader?
-
- Member
- Posts: 19
- Joined: Sat Jul 06, 2024 17:34
- In-game: NicoKaiser
- Blockhead
- Moderator
- Posts: 2096
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
If you mean the one from digistuff, it is documented here.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
Who is online
Users browsing this forum: No registered users and 5 guests