Skip to content

Using ClickCrystalsScript

ImproperIssues edited this page Nov 11, 2023 · 32 revisions

ClickCrystalsScript

aka ClickScript or CCS- a fast and easy way to create modules from simple swapping, to selective interactions in game! CCS consists of a lot of CCS commands, and can be either executed separately or together in a .ccs file, like a Minecraft datapack!

Not enough modules? Your wonderful ideas aren't getting accepted? Want private features but don't know how to code? No worries, make your own modules with ClickCrystalsScripts (CCS)!

CCS Command Arguments

CCS Command Lines have a variety of commands with their own specific arguments. Below is a table of arguments and their behaviors.

Argument Description Possible values
<CCS args...> Any command line Any CCS command line
<N> A number Decimal or whole number depending on the command line
<item>, <block> An item, : means direction name, # means name contains #sword, #totem, :totem_of_undying, #glass, etc.
<message> A string Any string/text
<input> User input type attack, use, forward, backward, strafe_left, strafe_right
<event> Event listener type left_click, right_click, middle_click, left_release, right_release, middle_release, break_block, place_block, interact_block, punch_block, tick
<condition type> Conditions for blocks and items inventory_has, hotbar_has, target_block, target_entity, holding
module: <action> Module action create, enable, disable
module: <name> A module ID, spaces should be - instead, all lowercase letters custom-module, new-module, etc.

CCS Command Lines

Below is a table of current CCS command lines that are available for custom module or util development.

Command Description Usage Example
exit Crashes the program exit <exit code> exit -1
print Prints something into the console print <message> print Hello World!
throw Throws an error in the console throw <message> throw You can't do that!
execute Runs any CCS command line execute <CCS args...> execute print Hello World!
loop Loops any CCS command line N times loop <N> <CCS args...> loop 5 print Hello World!
module Module management module <action> <name> module create my-first-module, module enable anchor-switch
description Sets custom module's description description <message> description This is my first module!
on Registers an event listener on <event> <CCS args...> on right_click if holding :diamond send This diamond is shiny!
switch Searches for an item in your hotbar switch <item> switch :end_crystal, switch #sword
say Says or executes a command in chat say <message> say Hello everyone, say /give @s diamond 64
input Simulates a user input input <input> input attack, input use, input forward, input strafe_left
wait Waits for N seconds before running a CCS command line wait <N> <CCS args...> wait 0.5, wait 3.7, wait 1
if Runs a CCS command line if condition satisfies if <condition type> <item/block> if holding :diamond say Got a diamond, if target_block #glass say Glass
if_not Runs a CCS command line if condition DOES NOT satisfy if_not <condition type> <item/block> if_not target_entity :player say Not looking at player
send Sends a message to the client player send <message> send Hello World!

Create Modules Using CCS

CCS Script Files

All CCS modules should be in CCS script files. Script files are read from the folder .minecraft/ClickCrystalsClient/scripts/, so it is crucial to create your CCS script files there. All CCS script files should have the file name extension .ccs or they will be skipped.

You can have more than one CCS modules all in one CCS script file, but it is recommended to create them separately for organization and tidiness.

CCS Errors and Exceptions

When creating any code, not matter what script or language, errors are to be excepted. We made sure that CCS provides a clean print in the console of what error has occurred, and where it came from:

Error found in ClickScript command execution:
    from: io.github.itzispyder.clickcrystals.client.clickscript.exceptions
    type: UnknownCommandException
    message: 'No such command found'

    execution-details:
    -name: 'this'
    -command: 'this is NOT a command'
    -location: [line 7 at '.minecraft/ClickCrystalsClient/scripts.css']

Module name declaration

All CCS modules should have a name declaration before anything. The next part, although optional is to give the module a description as well.

module create foo
description Foo's description

CCS Comments

CCS comments are similar to that of Java, just use double slashes like so: //

// module declaration
module create foo
description Foo's description

// module contents...

Module contents

After creating the module's name and description, that's it! All you gotta do now is to register some events for the module to function in game. You can type any CCS command line (or as you know, <CCS args...>) below the module declaration.

// module declaration
module create foo
description Foo's description

// module contents...
on right_click if holding :diamond say /give @s diamond

Reloading CCS

All CCS script files (.ccs in .minecraft/ClickCrystalsClient/scripts/xxx.ccs) can be reloaded by simply executing our custom client command

,ccs reload-scripts

Do note that upon reload CCS scripts, all custom CCS modules will disable. CCS modules save to the same config that other modules do.

Our Examples

module create silk-touch
description Makes any tool silk touch - "I_Got_You_Dead"

on tick say I just made my tool silk touch, this is not possible and I will now crash my game.
on tick module disable silk-touch
on tick exit -1
module create potion-switch
description Right click your sword to throw a potion

on right_click if holding #sword wait 0.05 if_not holding #sword switch #sword
on right_click if holding #sword switch #splash_potion
module create trigger-bot
description Spam hits a player when you look at them

on tick if target_entity :player input attack

Clone this wiki locally