• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Script does not compile

Status
Not open for further replies.
JASS:
//==================================================================================================
// 
// Generated Map Script
// 
// Name:   Eine Karte f??r StarCraft II
// Author: Unbekannter Autor
// 
//==================================================================================================
include "TriggerLibs/NativeLib"

//--------------------------------------------------------------------------------------------------
// Library: CustomShooter
//--------------------------------------------------------------------------------------------------
// Trigger Declarations
trigger lib1_gt_CS_Init;
trigger lib1_gt_CS_Move;
trigger lib1_gt_CS_Key_Press;
trigger lib1_gt_CS_Key_Release;

// Triggers
//--------------------------------------------------------------------------------------------------
// Trigger: CS_Init
//--------------------------------------------------------------------------------------------------
bool lib1_gt_CS_Init_Func (bool testConds, bool runActions) {
    int auto629881B1_as;
    int auto629881B1_ae;
    int auto629881B1_ai;

    // Actions
    if (!runActions) {
        return true;
    }

    auto629881B1_as = 1;
    auto629881B1_ae = PlayerGroupCount(PlayerGroupAll());
    auto629881B1_ai = 1;
    gv_cS_I = auto629881B1_as;
    if (auto629881B1_ai > 0 || (auto629881B1_ai == 0 && auto629881B1_as < auto629881B1_ae)) {
        while (gv_cS_I <= auto629881B1_ae) {
            if ((PlayerStatus(gv_cS_I) == c_playerStatusActive) && (PlayerType(gv_cS_I) == c_playerTypeUser)) {
                libNtve_gf_CreateUnitsAtPoint2(1, "Marine", 0, gv_cS_I, PointFromId(1));
                gv_cS_Units[gv_cS_I] = UnitLastCreated();
            }
            else {
            }
            gv_cS_I = gv_cS_I + auto629881B1_ai;
        }
    }
    else if (auto629881B1_ai < 0 || (auto629881B1_ai == 0 && auto629881B1_ae < auto629881B1_as)) {
        while (gv_cS_I >= auto629881B1_ae) {
            if ((PlayerStatus(gv_cS_I) == c_playerStatusActive) && (PlayerType(gv_cS_I) == c_playerTypeUser)) {
                libNtve_gf_CreateUnitsAtPoint2(1, "Marine", 0, gv_cS_I, PointFromId(1));
                gv_cS_Units[gv_cS_I] = UnitLastCreated();
            }
            else {
            }
            gv_cS_I = gv_cS_I + auto629881B1_ai;
        }
    }
    TimerStart(gv_cS_Timer, 5.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib1_gt_CS_Init_Init () {
    lib1_gt_CS_Init = TriggerCreate("lib1_gt_CS_Init_Func");
    TriggerAddEventMapInit(lib1_gt_CS_Init);
}

//--------------------------------------------------------------------------------------------------
// Trigger: CS_Move
//--------------------------------------------------------------------------------------------------
bool lib1_gt_CS_Move_Func (bool testConds, bool runActions) {
    int auto5F6F8960_as;
    int auto5F6F8960_ae;
    int auto5F6F8960_ai;

    // Actions
    if (!runActions) {
        return true;
    }

    auto5F6F8960_as = 1;
    auto5F6F8960_ae = PlayerGroupCount(PlayerGroupAll());
    auto5F6F8960_ai = 1;
    gv_cS_I = auto5F6F8960_as;
    if (auto5F6F8960_ai > 0 || (auto5F6F8960_ai == 0 && auto5F6F8960_as < auto5F6F8960_ae)) {
        while (gv_cS_I <= auto5F6F8960_ae) {
            if ((gv_cS_KeyStates[][gv_cS_KEY_UP] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropMinerals, c_playerPropOperAdd, 1);
            }
            else {
            }
            if ((gv_cS_KeyStates[][gv_cS_KEY_DOWN] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropMinerals, c_playerPropOperSubtract, 1);
            }
            else {
            }
            if ((gv_cS_KeyStates[][gv_cS_KEY_LEFT] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropVespene, c_playerPropOperAdd, 1);
            }
            else {
            }
            if ((gv_cS_KeyStates[][gv_cS_KEY_RIGHT] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropVespene, c_playerPropOperSubtract, 1);
            }
            else {
            }
            gv_cS_I = gv_cS_I + auto5F6F8960_ai;
        }
    }
    else if (auto5F6F8960_ai < 0 || (auto5F6F8960_ai == 0 && auto5F6F8960_ae < auto5F6F8960_as)) {
        while (gv_cS_I >= auto5F6F8960_ae) {
            if ((gv_cS_KeyStates[][gv_cS_KEY_UP] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropMinerals, c_playerPropOperAdd, 1);
            }
            else {
            }
            if ((gv_cS_KeyStates[][gv_cS_KEY_DOWN] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropMinerals, c_playerPropOperSubtract, 1);
            }
            else {
            }
            if ((gv_cS_KeyStates[][gv_cS_KEY_LEFT] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropVespene, c_playerPropOperAdd, 1);
            }
            else {
            }
            if ((gv_cS_KeyStates[][gv_cS_KEY_RIGHT] == 1)) {
                PlayerModifyPropertyInt(gv_cS_I, c_playerPropVespene, c_playerPropOperSubtract, 1);
            }
            else {
            }
            gv_cS_I = gv_cS_I + auto5F6F8960_ai;
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib1_gt_CS_Move_Init () {
    lib1_gt_CS_Move = TriggerCreate("lib1_gt_CS_Move_Func");
    TriggerAddEventTimer(lib1_gt_CS_Move, gv_cS_Timer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: CS_Key_Press
//--------------------------------------------------------------------------------------------------
bool lib1_gt_CS_Key_Press_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    if ((EventKeyPressed() == c_keyUp)) {
        gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_UP] = 1;
    }
    else {
        if ((EventKeyPressed() == c_keyDown)) {
            gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_DOWN] = 1;
        }
        else {
            if ((EventKeyPressed() == c_keyRight)) {
                gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_RIGHT] = 1;
            }
            else {
                if ((EventKeyPressed() == c_keyLeft)) {
                    gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_LEFT] = 1;
                }
                else {
                }
            }
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib1_gt_CS_Key_Press_Init () {
    lib1_gt_CS_Key_Press = TriggerCreate("lib1_gt_CS_Key_Press_Func");
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Press, c_playerAny, c_keyUp, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Press, c_playerAny, c_keyRight, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Press, c_playerAny, c_keyLeft, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Press, c_playerAny, c_keyDown, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
}

//--------------------------------------------------------------------------------------------------
// Trigger: CS_Key_Release
//--------------------------------------------------------------------------------------------------
bool lib1_gt_CS_Key_Release_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    if ((EventKeyPressed() == c_keyUp)) {
        gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_UP] = 0;
    }
    else {
        if ((EventKeyPressed() == c_keyDown)) {
            gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_DOWN] = 0;
        }
        else {
            if ((EventKeyPressed() == c_keyRight)) {
                gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_RIGHT] = 0;
            }
            else {
                if ((EventKeyPressed() == c_keyLeft)) {
                    gv_cS_KeyStates[EventPlayer()][gv_cS_KEY_LEFT] = 0;
                }
                else {
                }
            }
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void lib1_gt_CS_Key_Release_Init () {
    lib1_gt_CS_Key_Release = TriggerCreate("lib1_gt_CS_Key_Release_Func");
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Release, c_playerAny, c_keyUp, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Release, c_playerAny, c_keyRight, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Release, c_playerAny, c_keyLeft, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
    TriggerAddEventKeyPressed(lib1_gt_CS_Key_Release, c_playerAny, c_keyDown, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
}

void lib1_InitTriggers () {
    lib1_gt_CS_Init_Init();
    lib1_gt_CS_Move_Init();
    lib1_gt_CS_Key_Press_Init();
    lib1_gt_CS_Key_Release_Init();
}

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
void lib1_InitLib () {
    lib1_InitTriggers();
}

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
void InitLibs () {
    libNtve_InitLib();
    lib1_InitLib();
}

//--------------------------------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------------------------------
timer gv_cS_Timer;
unit[13] gv_cS_Units;
int gv_cS_I;
int[13][5] gv_cS_KeyStates;
int gv_cS_KEY_DOWN;
int gv_cS_KEY_UP;
int gv_cS_KEY_LEFT;
int gv_cS_KEY_RIGHT;

void InitGlobals () {
    int init_i;
    int init_j;

    gv_cS_Timer = TimerCreate();
    init_i = 0;
    while (init_i <= 12) {
        gv_cS_Units[init_i] = null;
        init_i = init_i + 1;
    }
    gv_cS_I = 0;
    init_i = 0;
    while (init_i <= 12) {
        init_j = 0;
        while (init_j <= 4) {
            gv_cS_KeyStates[init_i][init_j] = 0;
            init_j = init_j + 1;
        }
        init_i = init_i + 1;
    }
    gv_cS_KEY_DOWN = 1;
    gv_cS_KEY_UP = 2;
    gv_cS_KEY_LEFT = 3;
    gv_cS_KEY_RIGHT = 4;
}

//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void InitMap () {
    InitLibs();
    InitGlobals();
}

I don't get why it doesn't compile. It says
Syntax Error:
JASS:
    gv_cS_I = auto629881B1_as;

Edit:
Never mind, I fixed, I made the variables local instead of globals.
 
Level 3
Joined
Jul 12, 2007
Messages
50
o_O please tell me... how do you get this level of access to Galaxy script? Also what is up with the almost seemingly random integer names?
 
Level 1
Joined
Sep 7, 2010
Messages
1
Try moving your global variables above the erroring function. Compilers have to have a definition of the item before you can reference it. Only newer more complex compilers have the ability to do late binding like that. Think of a function definition "signature". They are all at the top of your code so the compiler sets up late binding for the functions. You can probably get that same type of error if you were to re-arrange the order of your functions.

Hopefully, this solution isn't way wrong. Let me know if this fixes your issue.
 
Level 11
Joined
Aug 1, 2009
Messages
963
o_O please tell me... how do you get this level of access to Galaxy script? Also what is up with the almost seemingly random integer names?
Automatically generated integers that the game uses.

Also, you just go into View Map Script. If you want to add your own galaxy code, create new custom script segments using right click in the trigger editor.
 
Status
Not open for further replies.
Top