Skip to content

Using ClickCrystalsScript

ImproperIssues edited this page Nov 22, 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)!

Bro, what is all this.

Too many words here? DW! Take my simplified course on my GitHub Page (https://itzispyder.github.io/clickscript)

Welcome to CCS

A fast and easy way to make modules using simple script commands!

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, jump, lock_cursor, unlock_cursor, left, right, middle, inventory
<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, game_join, game_leave
<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: <then> Executes a CCS command line when the camera rotation finishes then <CCS args...>
<eval> Compares for if command >N, >=N, <N, <=N, ==N, !=N
drop: <action> How to drop the hotbar item one, all
config: <action> For the ClickCrystals config save, reload

NOTICE: For eval argument DO NOT have a space between the operator and N !!!
NOTICE: For eval argument DO NOT have a space between the operator and N !!!
NOTICE: For eval argument DO NOT have a space between the operator and 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
gui_switch Searches for an item in your inventory then hovers over it gui_switch <item> gui_switch #totem
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
wait_random Waits random for N1 to N2 seconds before running a CCS command line wait_random <N1> <N2> <CCS args...> wait_random 0.0 0.5 input attack
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:<then> turn_to nearest_entity :player, turn_to nearest_entity :player then input attack
loop_period Loops slowly with a period loop-period iterations:<N> period:<N> <CCS args...> loop_period 10 0.5 send Hello World!
drop Drops your selected item drop <action> drop one, drop all
config Manages config config <action> config save, config reload

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 then 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!
module_enabled Takes in a module ID (all lowercase, spaces replaced with -) if module_enabled anchor-switch send Hello World!
...the rest... The rest just takes in a <item/block/entity> argument, as normal ...as seen from examples in the previous tables...

"Then" chains

As a recent addition to the script, then chains get pretty tricky to understand since they only work on some commands. Then chains can only be applied when the command does not already accept <CCS args...> at the end and only has a few arguments.

Commands that support then chains:
- input
- module
- switch
- gui_switch
- swap
- turn_to
- if
- if_not
- wait
- wait_random
- on
- 

Commands that you might think support then chains but directly executes commands instead:
- loop
- loop_period

Commands that DO NOT support then chains:
- print
- throw
- execute
- say
- send
- exit

Here is one example of a then chain:

// module declaration
module create legit-auto-totem
description Legit auto totem

// module contents
on totem_pop if hotbar_has #totem switch #totem wait 0.05 swap then switch back

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 reloading 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 declaration
module create legit-auto-totem
description Swaps to a totem in the hotbar and then to the offhand when a totem is popped

// module contents
on totem_pop switch #totem
on totem_pop wait 0.05 if holding #totem swap
module create command-macros
description All kinds of command macros, add more in the script file!

on key_press j say /spawn
on key_press k say /home home
on key_press l say /dupe
module create right-click-aim
description Real not hax

on right_click if holding #sword turn_to nearest_entity :player then if attack_progress >=0.9 input attack
module create auto-crystal
description When holding crystal, you would automatically turn to nearest obsidian and start crystalling

on tick if holding :end_crystal if_not target_block :obsidian turn_to nearest_block :obsidian

// previous explosion blasted you backwards
on tick if holding :end_crystal if target_block :obsidian input forward

on tick if holding :end_crystal if target_block :obsidian input use

// prevent the next explosion from blasting you too far away
on tick if holding :end_crystal if target_entity :end_crystal input forward

on tick if holding :end_crystal if target_entity :end_crystal input attack

Here are all CCS command starters to get you started.

Default Supported:
- exit
- print
- throw
- execute 
- loop

Module Management:
- module create
- module enable
- module disable
- description
- config save
- config reload

In-game Interactions:
- switch
- gui_switch
- drop one
- drop all
- swap
- wait
- wait_random
- send
- input forward
- input backward
- input strafe_left
- input strafe_right
- input sneak
- input attack
- input use
- input jump
- input lock_cursor
- input unlock_cursor
- input left
- input right
- input middle
- input inventory
- turn_to nearest_entity
- turn_to nearest_block
- loop_period

Events Registration:
- on left_click
- on right_click 
- on middle_click
- on left_release
- on right_release
- on middle_release
- on break_block
- on place_block
- on interact_block
- on punch_block
- on tick
- on item_use
- on item_consume
- on totem_pop
- on death
- on damage
- on module_enable
- on module_disable
- on move_pos
- on move_look
- on key_press
- on key_release
- on game_join
- on game_leave

If Conditions:
- if inventory_has
- if hotbar_has
- if target_block
- if target_entity
- if holding
- if off_holding
- if entity_in_range
- if block_in_range
- if input_active
- if attack_progress
- if armor
- if health
- if pos_x
- if pos_y
- if pos_z
- if module_enabled

Clone this wiki locally