Ducky Peripherals Basic Tutorial Ducky Peripherals Minecraft Game

This tutorial is set by the author to use the CC by-NC protocol.

introduction

For the basic operation of CC, please see this tutorial: Study CC from scratch -COMPUTERCRAFT Light Scanning Training Course

This tutorial mainly introduces the relevant functions and specific examples of the core port and core links.

Supported IOTA type

IOTA type Format null

{"null": true}

Rubbish

{"garbage": true} ※

Value DOUBLE BOOLEN vector

{"x": double, "y": double, "z": double}

List of non -empty list []

Entity [Except player]

{"UUID": UUID, [^] "name": string}

Pattern IOTA

{"Startdir": Starting direction of pattern, "angles": pattern and pen order}

※ If the identification format does not conform to all the above IOTA formats, it will automatically convert into garbage.

※ Warm reminder, because CC does not support Chinese, all Chinese spells will automatically become garbage when exporting, and it cannot be read normally when importing.

Core port

The core port allows you to read and write the core placed in the core through CC. The specific functions are as follows.

Core link

The core link allows you to control the IoTA sending and receiving through the CC control link. You can also use this method to realize the rapid transmission of IoTA between different computers. Use this function to install a spell expansion module.Introduction to wiki expanded by the spell.

Simple method storage program

This program is mainly used for simple storage and reading of spell lists, and requires a core port.Put the code into hex.lua in the corresponding folder, enter the hex save IoTA stored in the core port of the core port, deposit in the specified file, enter the hex load to read the specified file and copy the corresponding IOTA to the corresponding IOTA to the corresponding IOTA toIn the core.

-Simple utility script to load a hex into a focal port

LOCAL COMPLETION = Require ("CC.Shell.compleTion")

Shell.setCompltingFunction (shell.getrunningprography (), complex

{CompleTion.choice, {"save", "load"}},

CompleTion.file

))

local args = {...}

if #args <2 THEN

Error ("USAGE: Hex ")

end

local mode = args [1]

local file = ARGS [2]

if (mode ~ = "save") and (mode ~ = "load") then error ("Mode Must be either save or load (case sensitive), Got:" .. Mode)

end

local p = Peripheral.find ("Focal_port")

if mode == "load" then

If not fs.exists (file) the error ("File Must Exist when loading") end)

Local f = fs.open (file, "r")

Local d = f.readall ()

F.Close ()

Local dat = textutils.unserializejson (d)

Print ("Succeded:" .. Tostring (P.Writeiota (DAT)))

else

Local f = fs.open (file, "w")

Local d = p.Readiota () ()

F.write (textutils.serialisejson (d))

F.flush ()

F.Close ()

Print ("Saved IOTA To:" .. File)

end

Reference link

https://github.com/samsthenerd/ducky- periphs/wiki

Curse Law Community Discord