Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
-- startup.lua — Mélodie d'accueil (speaker à gauche) local SIDE = "left" -- le haut-parleur est à gauche local INSTRUMENT = "harp" -- autres possibles: "bell","chime","xylophone", etc. local VOLUME = 1.0 -- 0.0 à 3.0 selon CC:Tweaked -- Récupération du périphérique speaker local sp = peripheral.wrap(SIDE) if not sp or peripheral.getType(SIDE) ~= "speaker" then -- sécurité: on tente de trouver un speaker ailleurs sp = peripheral.find("speaker") end if not sp then print("Aucun 'speaker' détecté. Place un haut-parleur sur le côté gauche.") return end -- Petite aide pour jouer une note local function note(pitch, dur) -- pitch: entier 0..24 (gamme note block Minecraft) -- dur: durée en secondes sp.playNote(INSTRUMENT, VOLUME, pitch) sleep(dur or 0.12) end -- Jingle d'accueil (arpège + petite descente) -- Pitches choisis pour faire un C majeur '8-bit' : C-E-G-C' puis retour local seq = { {12, 0.14}, -- C {16, 0.14}, -- E {19, 0.14}, -- G {24, 0.22}, -- C' (octave) {19, 0.12}, -- G {16, 0.12}, -- E {12, 0.18}, -- C } -- Petit "whoosh" d'ouverture (glissando) for p = 9, 12 do note(p, 0.06) end -- Mélodie principale for _, n in ipairs(seq) do note(n[1], n[2]) end -- Tint final (accord court C-E-G simultané simulé) sp.playNote(INSTRUMENT, VOLUME, 12) sp.playNote(INSTRUMENT, VOLUME, 16) sp.playNote(INSTRUMENT, VOLUME, 19) sleep(0.18)
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)