| 02-09-2010, 07:11 AM | #1 |
EDIT: I posted this too soon, simply missed a bracket on the IF statement itself. Here is a simple trigger I made while attempting to learn the Zinc syntax: Code:
library InitTrig_RichMode
{
trigger gg_trg_RichMode;
integer idx;
function Trig_RichMode_Actions()
{
DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,20,"All Players will receive 100000 gold.\n");
idx = 0;
while (idx >= bj_MAX_PLAYERS)
{
if (GetPlayerSlotState(Player(idx) == PLAYER_SLOT_STATE_PLAYING)
{
SetPlayerState(Player(idx),PLAYER_STATE_RESOURCE_GOLD,100000);
}
idx = idx + 1;
}
// can only be run once
DestroyTrigger(gg_trg_RichMode);
}
// initialize the trigger
function onInit()
{
gg_trg_RichMode = CreateTrigger();
TriggerRegisterPlayerChatEvent(gg_trg_RichMode,Player(0),"-rich",true);
TriggerRegisterPlayerChatEvent(gg_trg_RichMode,Player(1),"-rich",true);
TriggerAddAction(gg_trg_RichMode,function Trig_RichMode_Actions);
}
}And the error I get is "Unexpected {" and it's refering to the first curly brace after the IF statement. Any ideas what I'm missing here? |
| 02-09-2010, 09:14 PM | #2 |
Zinc:if (GetPlayerSlotState(Player(idx) == PLAYER_SLOT_STATE_PLAYING) |
| 02-09-2010, 09:48 PM | #3 | |
You missed his first line: Quote:
|
