Skip to content

Commit

Permalink
More docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
iChun committed May 28, 2021
1 parent 6327487 commit 141b44f
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 13 deletions.
16 changes: 8 additions & 8 deletions docs/gettingstarted/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ If you would like to read more on installing CCI on a server, [read here](./ccio

Throughout these docs there will be a couple of mentions of similarly sounding phrases. This is the list of important distinctions and differences between the similarly sounding phrases.

| Phrase | Definition |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Stream Event | These are events that happen on stream. Subscriptions, cheers, chat messages, etc |
| Event | These are stream events that are processed and passed on to you to process. More on this later. |
| Config Event | These are events configured in CCI to act on the aforementioned Events. These contain conditions, outcomes, etc. More on that later. |
| <br/> | |
| Mod Config | The mod configuration file used to configure the mod. These contain your socket keys and should never be shown to others. |
| Config | The configuration files CCI uses to understand what to do with your Stream Events. These collectively form Events and are saved in JSON files. |
| Phrase | Definition |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Stream Event | These are events that happen on stream. Subscriptions, cheers, chat messages, etc |
| Event | These are stream events that are processed and passed on to you to process. More on this later. |
| Config Event | These are events configured in CCI to act on the aforementioned Events, stored in an Event Configuration. These contain conditions, outcomes, etc. These may also be referenced as just `Event`. Understand which Event type is being referenced through the context. More on that later. |
| <br/> | |
| Mod Config | The mod configuration file used to configure the mod. These contain your socket keys and should never be shown to others. |
| Config | The configuration files CCI uses to understand what to do with your Stream Events. These collectively form Events and are saved in JSON files. |

First Launch
------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Content Creator Integration - Documentation

Welcome to the official documentation for [Content Creator Integration](https://www.curseforge.com/minecraft/mc-mods/content-creator-integration/).

This documentation was written based off of version 1.8.1. These docs are aimed to be a reference or a guide for people trying to understand how Content Creator Integration works.
This documentation was written based off of version 1.9.0. These docs are aimed to be a reference or a guide for people trying to understand how Content Creator Integration works.

Contribute to the docs at [GitHub](https://github.com/iChun/ContentCreatorIntegration-IssuesAndDocumentation).

Expand Down
4 changes: 3 additions & 1 deletion docs/intermediate/configspecifics.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Setting this to `null` disables the filter, and CCI will funnel all Events into

## Event

Some of these are self-explanatory. I'll detail some that needs special mention.
Some of these are self-explanatory. I'll detail those that needs special mention.

### Constant Name (name: `constantName`)

Expand Down Expand Up @@ -125,6 +125,8 @@ Inverse match, well, reverses the result.

Eg, if you're checking if a variable exists, the condition will fail if the variable doesn't exist, and pass if it does. With inverse match, the condition passes if the variable doesn't exist, and fails if it does.

There will be some places where this field is ignored, but not many. Check the documentation of each object you're using to see if it is.

## Outcomes

Similarly to Conditions, this bit only covers Outcomes in general, each outcome has their own fields and different behaviours. Check them out on their own documentation page.
Expand Down
59 changes: 59 additions & 0 deletions docs/intermediate/constants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Constants, the Solution to Insanity
===================================

As you probably have seen, the term "constants" have been used every now and then. Constants are, to a degree, a way to direct a Config Event Object to a static reference.

Think of it this way. When you get bits, you spawn a pig. You get a subscription, you spawn a pig. You get raided, you spawn a pig, You get a follow, you sp-well, you see the pattern. In every one of those Config Events, you have a `CommandOutcome` that spawns the pig. But then round comes October, and in your "festive" mood, you decide to spawn a ~~Zombie Pigman~~ Piglin instead. There you go changing 4+ Outcomes.

Here's where you're thinking: "*There has to be a better way!*". The solution to that, is Constants. Have all those Outcomes point to the same, one Constant, change the Constant, change them all. That's the idea.

## How to use Constants

First, let's look at Constants in the Editor:

![](./images/constants/constants.png){: class="img_center"}
<br />
<br />

Off the bat, you can see there's three different type of Constants. Conditions, Outcomes and Config Events. To add a Constant, you first need to think of a name for it. This will be the reference to the constant, so you cannot use conflicting names. Set the name, and if you're adding a Condition or an Outcome, select one. Do whatever you want inside the Object, at this point I'd hope you'd know how to do that (You may have to go back to the Getting Started section for a refresher if you don't).

For the purposes of this guide, I'll be adding a `ToastOutcome` to the constant name `ConstantToastExample`:

![](./images/constants/toastexample.png){: class="img_center"}
<br />
<br />

Now, you're probably wondering, how to reference this. Config Events and Conditions/Outcomes differ slightly, as such:

#### Event

Config Events use the `constantName` field.

![](./images/constants/eventconstantname.png){: class="img_center"}
<br />
<br />

When using this field, some of the Config Event's behaviour changes. Most of the Config Event's fields are ignored (the Constant Event's is used instead) except for the following:

* Queues & Play Time
* Delays
* Cooldowns

These are intentionally kept separate from the Constant Event as different Event Types may have different queues etc. In the Constant Event, you may check the Event type and such by checking the `cci-type` variables.

#### Conditions and Outcomes

These use the `ConstantCondition` or `ConstantOutcome` Objects. Double clicking on the `name` field will open up the Constants selector. Shift Double Clicking will open up the usual String editor for manual input.

Here in this `ConstantOutcome` you can see our only Constant Outcome in the list, the `ConstantToastExample`:

![](./images/constants/outcomeconstantname.png){: class="img_center"}
<br />
<br />
<br />

#### Final Note

Be careful not to reference a constant recursively without having some kind of break out of that loop. If you do, the game will lock up and crash. CCI makes no checks for this.

The `constantName` and `name` fields in Event and Condition/Outcome also support Variable Insertion. Be mindful of this!
28 changes: 28 additions & 0 deletions docs/intermediate/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Debugging the PEBKAC Issue
==========================

Naturally, with the flexibility that CCI offers, there will be hiccups here or there. This page aims to help you figure out what went wrong, and where.

Unfortunately, CCI was not built with debugging in mind. As such, debug functions are lackluster. What can be offered, however, are two simple tools: The `LogArgsCondition` and the `Dump Events` functions. We will not talk about `Debug Mode` here, that is explained [here](url.tbd).

## The Log Args Condition

Errorously named, [this condition](url.tbd) is more akin to a "Log Variables Condition". To use this, you first need the Java Console open, as this conditions spits out the information there. You'll have to look up how to open this console for your specific launcher, I'm afraid.

### How it works

The `LogArgsCondition`, when triggered, collects all of the Global Variables and Local Variables and puts them into the Java Console. As the Event Viewer only shows you variables *after* the Event has been processed, this lets you see how the variables change as Conditions and Outcomes change them.

To use this in within the Outcomes block, use a `ConditionalOutcome`.

<br />

## Dump Events

In the Event Viewer, there is a button called `Dump Events`.

![](./images/debugging/dumpevents.png){: class="img_center"}
<br />
<br />

Clicking on this button dumps the variables of all **cached** Events, for all the socket layers connected at the time, into a `dump.json` file, in your profile folder. However, this function was made pre-dating the CCI Editor, so what this essentially does is [serialises](https://en.wikipedia.org/wiki/Serialization) what you can see in the Event Viewer.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/intermediate/images/constants/constants.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/intermediate/images/debugging/dumpevents.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/intermediate/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
I'm Making A Note Here, Huge Success!
=====================================

~~For the good of all of us, except the ones who are dead~~

Here we talk about Notes, and how they differ from Variables. Notes are, essentially, variables that save to disk. Variables are all kept in memory and thus are lost when the Event ends or Minecraft closes. Notes are loaded up when the profile loads, and saved to disk when added/modified.

These are the few Event Objects you can use to work with Notes:

| Type | Name | ID | Description |
| --------- | ------------------------------ | -------------- | --------------------------------------------- |
| Condition | [NoteCondition](url.tbd) | `note` | Loads a note into a variable (if not expired) |
| Condition | [NotesListCondition](url.tbd) | `notesList` | Puts the list of note names into a variable |
| Outcome | [NoteOutcome](url.tbd) | `note` | Saves a note to disk |
| Outcome | [NoteDeletionOutcome](url.tbd) | `noteDeletion` | Deletes a note from disk |

Notes only bridge the gap between the disk and CCI. Essentially, you load a note into a variable, and save a variable into a note. Check the individual pages of the Event Objects above for more info.
9 changes: 6 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ nav:
- Intermediate Guides:
- Intermediate Difficulty, the old Advanced Difficulty: 'intermediate/index.md'
- Getting the Most Out of Your Event Configuration: 'intermediate/configspecifics.md'
- Constants, the Solution to Insanity: 'intermediate/constants.md'
- I'm Making A Note Here, Huge Success!: 'intermediate/notes.md'
- Debugging the PEBKAC Issue: 'intermediate/debugging.md'
- How To's:
- How To's, a How To: 'howto/index.md'
- Capturing Twitch's Channel Point Rewards: 'howto/twitchchannelpointreward.md' #No colons in the Title!
Expand All @@ -31,10 +34,10 @@ nav:
- Outcome: 'components/outcome/outcome.md'
- Constants: 'components/constants.md'

# Suggested intermediate: Constants, Notes. Math. . .
# Suggested advanced: Libraries, Understanding the Log File, Arrays, Strings, Dump.json/LogArgsCondition aka debugging, Online Configs. Init Events.
# Suggested intermediate: Dump.json/LogArgsCondition aka debugging, Online Configs.
# Suggested advanced: Libraries, Understanding the Log File and debug mode, Arrays, Strings: Untying the Knot, Init Events.
# Suggested expert: Game Hooks.
# How to, random mob, random chance, repeat outcome
# How to, random mob, random chance, repeat outcome, Math


# Do not edit in PRs below here
Expand Down

0 comments on commit 141b44f

Please sign in to comment.