Skip to content

Using ClickCrystalsScript

ImproperIssues edited this page Nov 12, 2023 · 32 revisions

ClickCrystalsScript - The Ultimate Module Maker

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>, <entity> An item, : means direct 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, sneak, lock_cursor, unlock_cursor
<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, item_use, item_consume, totem_pop, module_enable, module_disable, move_pos, move_look, key_press, key_release, damage, death
<condition type> Conditions for blocks and items inventory_has, hotbar_has, target_block, target_entity, holding, block_in_range, entity_in_range, off_holding, input_active, attack_progress, armor, health, pos_x, pos_y, pos_z
module: <action> Module action create, enable, disable
module: <name> A module ID, spaces should be - instead, all lowercase letters custom-module, new-module, etc.
turn_to: <what> A type of target nearest_entity, nearest_block
turn_to: <on_finish> Executes a CCS command line when the camera rotation finishes on_finish <CCS args...>
<eval> Compares for if command >N, >=N, <N, <=N, ==N, !=N

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. The key_press and key_release events are the only exceptions where it takes in a 2nd argument for key value. on <event> <CCS args...>, on keypress <key> on right_click if holding :diamond send This diamond is shiny!, on key_press e send You pressed e
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> <value> 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> <value> if_not target_entity :player say Not looking at player
send Sends a message to the client player send <message> send Hello World!
swap Swaps item with offhand swap swap
turn_to Turns to nearest block or entity turn_to <what> <block/entity> optional:<on_finish> turn_to nearest_entity :player, turn_to nearest_entity :player on_finish input attack
loop-period Loops slowly with a period loop-period iterations:<N> period:<N> <CCS args...> loop-period 10 50 send Hello World!

CCS If Conditions

CCS's if conditions are a bit tricky, so I will dedicate an entire section talking about them.

Condition types Why they are special Examples
attack_progress, armor, health, pos_x, pos_y, pos_z Takes in <eval> argument if health <=5 send Low health!, if armor ==20 send Full armor!, turn_to nearest_entity :player on_finish if target_entity :player if attack_progress >=0.9 input attack
entity_in_range, block_in_range Takes in 2 arguments, <entity/block> and <N>. For type and range in radius. if entity_in_range :creeper 5 send Creeper warning!, if block_in_range #diamond_ore 16 send Diamonds nearby!
input_active Takes in an <input> argument instead on tick if input active use send You are right clicking!
...the rest... The rest just takes in a <item/block/entity> argument, as normal ...as seen from examples in the previous tables...

Creating 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/test_script.ccs']

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
module create macro-spawn
description /spawn

on tick say /spawn
on tick module disable macro-spawn
module create right-click-aim
description Real not hax

on right_click if holding #sword turn_to nearest_entity :player on_finish input attack

Clone this wiki locally