# Logic Graphs (Kiscule)

Kiscule is probably the most powerful scripting tool in the idTech7 engine.

# What is Kiscule?

Kiscule is the replacement for SuperScript from id Tech 6, it was designed originally for The Void Engine (Dishonored 2). It underwent some evolution between the merge of id Tech 6 and Void and was renamed to just "logic entities" or "logic graphs" but we'll continue to refer to it as Kiscule because that's more succinct.

Kiscule does not exist in id Tech 6 (so it is not present in Doom 2016).

<p class="callout warning">**Note:** This page was originally written by Chrispy. It was recovered from the now-deleted idTech 7 wiki, and copied here with minimal edits. This section is incomplete and needs further research to expand upon it.</p>

## What can it do?

Kiscule is probably the most powerful scripting tool in the engine. It has variables (types int, vec3, string, angle, vec2, time, gameteam, float, entity, entitydef, entityclass, color, bool) as well as collections of these types (lists). Variables can be used as arguments to operations.

Kiscule can be used to do almost anything gameplay related.

## Example Usage

Here is a rough outline of a logic .decl, more complete examples can be found in the extracted .resources files, in the `generated/decls/logicentity` directory.

```
{
	edit = {
		versionNumber = 21;
    	mainGraph = {
			className = "idLogicGraphAssetEntityMain";
			object = {
				id = 2;
				pos = {
					x = -2168;
					y = -2273;
				}
				variables = {
					num = 0;
				}
				nodes = {
					num = 0;
				}
				links = {
					num = 0;
				}
			}
		}
	}
}
```

- All `id` are arbitrary, just pick a unique number.
- Any references to `pos` or to `icons` can be ignored. They are used in id Software's logic graph editor, which we don't have access to here. It doesn't affect anything in the game.
- Each `links` id is unique and doesn't seem to matter much.

You can also declare `pins` that go between `links`, here is an example:

```
pinVariables = {
	num = 1;
	item[0] = {
		id = 2;
		model = {
			className = "idLogicVariableModelEntityList";
		}
	}
}
```

# Available Operations

<p class="callout success">This list was dumped by listing all virtual classes with "idLogicNode" in their name, copying it and then using regex: `<sup>[</sup>\s]+ 12 ([<sup>\s]+)[</sup>\r]+`</p>

```
AbsFloat
AbsInt
ActivateOnPlayerStat
AddAngle
AddFloat
AddInt
AddTime
AddVec3
AISetSledMode
AIStartGladiatorStage2
Anchor
AndBool
ArcCosine
ArcSine
Automap
Begin
Bink
Bookmark
BoolToString
Branch
BranchCompareFloat
BranchCompareInt
BranchCompareString
BranchCompareTime
CeilFloat
CheckForSummonedEntity
CheckMapSubType
CinematicApplyDoubleVision
Class
Class_v2
ClassInputs
ClassOutputs
ColorToHSV
Comment
CompareBool
CompareFloat
CompareInt
CompareString
CompareTime
CosmeticsGameItem
Counter
CounterGate
CreateAngles
CreateColor
CreateVector3
CrossVec3
CustomEventBroadcast
CustomEventBroadcast_v2
CustomEventReceive
CustomEventReceive_v2
DamageListener
DebugGeometry
Delay
DemonBounty
DivideAngle
DivideFloat
DivideInt
DivideTime
DivideVec3
DormancyRadius
DotVec3
ElectricBolt
EntityActivate
EntityAdd
EntityAngularInterpolation
EntityApplyImpulse
EntityAxisDir
EntityAxisDirection
EntityBindTo
EntityComparison
EntityDeactivate
EntityDistance
EntityDormancy
EntityFX
EntityGetAngles
EntityGetAngularVelocity
EntityGetGameTime
EntityGetLinearVelocity
EntityGetName
EntityGetPlayer
EntityGetPosition
EntityGetRendermodelScale
EntityGuiPlay
EntityHighlight
EntityInteractableReceiveEvent
EntityInterface
EntityIsValid
EntityModify
EntityMove
EntityMoveTo
EntityOnActivated
EntityOnStartAnim
EntityPlayerUseProxyReceiveEvent
EntityPlayNextAnimation
EntityPositionalInterpolation
EntityRemove
EntityRemoveEntitiesOfType
EntityRotate
EntityRotateTo
EntitySetBool
EntitySetDamage
EntitySetRendermodelScale
EntitySetRendermodelScale_v2
EntitySetVelocity
EntityShowHide
EntitySpawn
EntitySplineMove
EntityStopVelocity
EntityTargetSpawn
EntityTeleport
EntityTriggerReceive
EntityTriggerReceive_v2
EntityUnbind
EntityVisibleToPlayer
EnumerationToString
EventBroadcast
EventReceive
EventReceiveFromEntities
EventSendToEntities
ExecuteConsoleCommand
ExpandAngles
ExpandColor
ExpandVector3
FadeView
FlipBool
FloatMillisecondsToTime
FloatToString
FloatToTime
FloorFloat
Function
FunctionInputs
FunctionOutputs
GameBegin
GameMapLoaded
GameMutator
GameTimer
Gate
GetConsoleVariable
GetConsoleVariable_v2
GetDateString
GetEntitiesInRadius
GetLightRigLights
HSVToColor
IncrementFloat
IncrementInt
InteractAction
InteractListener
InteractPolling
InterfaceInputs
InterfaceOutputs
IntToString
KeyboardInput
LightControllerCommand
LightControllerCommand_V2
LightFade
LightSwitch
ListAdd
ListAppend
ListClear
ListCombine
ListForEach
ListGet
ListGetRandom
ListIsEmpty
ListIterate
ListLength
ListPopBack
ListPopFront
ListRemoveByIndex
ListRemoveByValue
ListSet
LoadMap
Log
LootDrop
MapLoaded
MasterLevelSettings
Menu
ModuloFloat
ModuloInt
MoverPolling
MoverPolling
MultiplyAngle
MultiplyFloat
MultiplyInt
MultiplyTime
MultiplyVec3
NodePlayerAddPerk
NormalizeVec3
NotBool
OneShotSound
OrBool
Placeholder
PlayerAdvancedScreenShake
PlayerApplyPeerCosmetics
PlayerBecomeDemon
PlayerCheatCode
PlayerCheckCodex
PlayerCineractive
PlayerCurrentAmmoType
PlayerDelayedDemonTransform
PlayerDetachFromWallClimb
PlayerEventListener
PlayerGetCurrentHealthAndArmor
PlayerGive
PlayerGiveCodex
PlayerGiveDemonCardDeck
PlayerGiveItems
PlayerGiveStatusEffect
PlayerGround
PlayerGround
PlayerInfiniteHammer
PlayerInhibitControls
PlayerInhibitLoadCheckpoint
PlayerInventoryCheck
PlayerModifyAbilities
PlayerModifyCurrency
PlayerModifyHealth
PlayerModifyInventory
PlayerOutOfAmmo
PlayerPlayBodyReaction
PlayerResetHands
PlayerResetSentinelArmor
PlayerSentinelArmor
PlayerSetGodMode
PlayerSetHudFlags
PlayerSetInfiniteAmmo
PlayerSetInhibitFlags
PlayerSetNoPlayerDeath
PlayerSetPendingHandsAction
PlayerStopDashAbility
PlayerToggleBodyReaction
PlayerToggleHud
PlayerToggleInfExtraLives
PlayPVPCallout
PlaySound
ProjectileLaunch
ProjectOntoPlane
PVP
RandomAngle
RandomFloat
RandomInt
RandomTime
RandomVec3
RayTrace
ReturnToMainMenuScreen
RollCredits
RotatePoint
SaveGame
SceneDirectorControl
SceneDirectorControl
SceneDirectorControl_v2
SceneDirectorControl_v3
Sequence
Sequence_v2
SetConsoleVariable
SetGameSoundState
SetGeomCacheTime
SetMusicState
SetMusicSwitch
State
StateInputs
StateOutputs
StringAppend
StringFormat
StringReferenceAppend
StringReferenceToLower
StringReferenceToUpper
StringToLower
StringToUpper
SubGraph
SubtractAngle
SubtractFloat
SubtractInt
SubtractTime
SubtractVec3
SwitchEnumeration
SwitchEnumeration_v2
SwitchInt
SwitchInt_v2
SwitchString
SwitchString_v2
TableAnimate
TableSample
TextCrawl
Timer
TimeToFloatMilliseconds
TimeToFloatSeconds
Tutorial
UIHudEvent
UINotification
UIWalkthrough
VariableGet
VariableGet_v2
VariableInline
VariableSet
VariableSet_v2
VariableSetReference
Vec3Magnitude
Vector3ToString
```