Cronus GPC Documentation
Cronus CommunityGPC LibraryGPC Guide
  • Welcome
  • Introduction
    • GPC Explained
    • What's New with Zen?
  • Basic Syntax
  • A Simple Tutorial
  • Style Guide
  • GPC Structure
  • Basic GPC Structure
  • Definitions
  • Data Section
  • Remapping
  • Variables
  • Init Section
  • Main Section
  • Combo Section
  • User Created Functions
  • GPC Programming Basics
  • Constants
    • Zen
      • OLED
      • ASCII Constants
      • PIO
    • Keyboard
      • Keyboard
    • Controller
      • Polar
      • LED
      • Rumble
      • PS3
      • PS4
      • XBox 360
      • Xbox One
      • Nintendo WII
      • Nintendo Switch
    • Racing Wheel
      • G29
      • G27
      • G25
      • DF
      • DF GT
      • DF Pro
    • Trace
    • Memory
    • Misc
  • Flow Control
  • Persistent Memory
  • Operator Types
  • Identifiers
  • Functions & Commands
    • Internal Functions
      • Bit Functions
      • Combo Functions
      • Math Functions
      • Device Functions
      • OLED Display Functions
    • Console Functions
      • Core Console Functions
    • Controller Functions
      • Core Controller Functions
      • Rumble Functions
      • LED Functions
    • Keyboard Functions
      • Core Keyboard Functions
  • GPC Examples
    • #1
Powered by GitBook
On this page

Was this helpful?

Definitions

The sole purpose of a definition is assign a value to a word and therefore make a script easier for a human to read. They do not use utilize any bytecode space in a script as they are not sent to the Cronus Zen. When a script is compiled the words are changed to their assigned value.

Syntax

define <name> = <value>;
<name>    : The name of the constant
<value>   : The value assigned to the constant

Only Integer values can be assigned to the value of a constant.

Once a word is defined and given a value, that word can be used anywhere in the script where a value is valid, as shown below;

define my_value = 50;

int myvar;
main {
    set_val(XB1_RT, my_value); 
    myvar = my_value;          
    if(myvar >= my_value) {    
    }
    if(get_val(XB1_LT) > my_value) { 
    }
}

A define is a static value and therefore cannot be changed during run time, as shown below;

define my_value = 50;
main {
    my_value = 70; 
}
PreviousBasic GPC StructureNextData Section

Last updated 5 years ago

Was this helpful?

If you wish to assign a value to a word and change its value during run-time, you would use a instead of a define.

variable