Unexpected : | ?!

jrhetf4xb

Member
Reaction score
12
It's driving me nuts... I have this script that keeps throwing me this error ( Unexpected : | ) on this* line:

JASS:

    function OnButtonClick()
    {
        button clickedButton = GetClickedButton();
        if (clickedButton == OPTION_ONE) 
        {
            if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))
            {
           // * the error always appears on the next line, even if I comment it out
                DisplayTextToPlayer(GetLocalPlayer(), 0., 0., "|cffffcc00 10 points|r will be needed to win");
            }
            POINTS_NEEDED = 10;
        }
    // same goes on...


Even though I have another script that has functions with the same names, I made them all private and the error still keeps popping out. :(
 

Ashlebede

New Member
Reaction score
43
Nice, another Zinc-er! =D<<

What is the [ljass]if (IsPlayerInForce(...))[/ljass] for? It should always return true, since the local player has to be one of the players.

Since the error always appears on that line, even if you comment it out, then the error is most likely on the previous line or before that... are you sure you ain't forgotten any [ljass]//! zinc[/ljass]'s?

Since there seems to be no [ljass]|[/ljass] at all except inside the string... um... can you show the whole source code / what it looks like when the error message appears (sometimes it's half-compiled)? Maybe it's not compiled correctly for some obscure reason...
 

Ashlebede

New Member
Reaction score
43
Hmm... I wonder if they do count as players in [ljass]bj_FORCE_ALL_PLAYERS[/ljass]... my guess would be they do, but who knows...
 

Ashlebede

New Member
Reaction score
43
:O<<

That's with the max number of player slots, but... but... but... maybe it's... um... always 12? So it would, like, count observers... since it's a constant, from... um... Blizzard.j and it's the kinda stuff that... meanie.

Edit:
JASS:


Ha! Meanie! Even neutral players!
 

jrhetf4xb

Member
Reaction score
12
The if comes from the BJ:
JASS:
function DisplayTextToForce takes force toForce, string message returns nothing
    if (IsPlayerInForce(GetLocalPlayer(), toForce)) then
        // Use only local code (no net traffic) within this block to avoid desyncs.
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message)
    endif
endfunction



Actually, this trigger and another one cooperate with each other but the second one requires this one. So there aren't any errors in the second.
Here's the current one that gives me the errors:

JASS:
//! zinc

library CTFLib requires TimerUtils
{
    public constant integer IID_THE_FLAG = &#039;I00A&#039;; 
    public boolean CTF_CHOSEN = false;
    public integer POINTS_NEEDED = 0;
    public item    THE_FLAG = null;

    public dialog CTF_DIALOG = null;
    public string CTF_DIALOG_MESSAGE = &quot;Select number of points needed:&quot;;
    private constant string CTF_STRINGOPT1 = &quot;10 kills&quot;, CTF_STRINGOPT2 = &quot;20 kills&quot;, CTF_STRINGOPT3 = &quot;30 kills&quot;;
    private constant integer VALUE_OPT1 = 10, VALUE_OPT2 = 20, VALUE_OPT3 = 30;
    private constant string MODE_ONE = &quot;10 points&quot;;
    private constant string MODE_TWO = &quot;20 points&quot;;
    private constant string MODE_THREE = &quot;30 points;
    private button OPTION_ONE, OPTION_TWO, OPTION_THREE;
    // ty cohadar:
    private constant integer HK_0 = 48;
    private constant integer HK_1 = 49;
    private constant integer HK_2 = 50;
    
    
    private function OnButtonClick()
    {
        button clickedButton = GetClickedButton();
        if (clickedButton == OPTION_ONE) 
        {
            if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))
            {
                //DisplayTextToPlayer(GetLocalPlayer(), 0., 0., &quot;|cffffcc00 10 points|r will be needed to win&quot;);
            }
            POINTS_NEEDED = 10;
        }
        else if (clickedButton == OPTION_TWO)
        {
            if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))
                DisplayTextToPlayer(GetLocalPlayer(), 0., 0., &quot;|cffffcc00 20 points|r will be needed to win&quot;);
            POINTS_NEEDED = 20;
        }
        else if (clickedButton == OPTION_THREE)
        {   
            if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))
                DisplayTextToPlayer(GetLocalPlayer(), 0., 0., &quot;|cffffcc00 30 points|r will be needed to win&quot;);
            POINTS_NEEDED = 30;
        }
        
        RemoveItem(THE_FLAG);
        //RemoveItem(THE_FLAG);
    }
    
    private function Callback()
    {
        if (CTF_CHOSEN)
        {
            THE_FLAG = CreateItem(IID_THE_FLAG, GetRandomReal(-2000., 2000.), GetRandomReal(-2000., 2000.));
            if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))
                DisplayTextToPlayer(GetLocalPlayer(), 0., 0., &quot;|cffff0000The flag was dropped, find it and keep it for as long as possible!|r&quot;);
        }
    }

    
    function onInit()
    {
        trigger trig = CreateTrigger();
        CTF_DIALOG = DialogCreate();
        DialogSetMessage(CTF_DIALOG, CTF_DIALOG_MESSAGE);
        OPTION_ONE = DialogAddButton(CTF_DIALOG, MODE_ONE, HK_0);
        OPTION_TWO = DialogAddButton(CTF_DIALOG, MODE_TWO, HK_1);
        OPTION_THREE = DialogAddButton(CTF_DIALOG, MODE_THREE, HK_2);
        TriggerRegisterDialogEvent(trig, CTF_DIALOG);
        TriggerAddAction(trig, function OnButtonClick);
        
        TimerStart(NewTimer(), 30., false, function Callback);
    }
    
}

//! endzinc


EDIT: OMG, pasting it here I noticed I forgot a " ... Silly TESH, I wish it could highlight everything between " " :/
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
>"The flag was dropped, find it and keep it for as long as possible!"

Doesn't sound like a capture the flag to me.
 

jrhetf4xb

Member
Reaction score
12
^ That's quite off topic but when I release the newest version of my map Spirit Wars you'll notice why I've done it like that. It's not an ordinary CTF because of how the action in the map flows. :thup:
 

Ashlebede

New Member
Reaction score
43
OMG, pasting it here I noticed I forgot a " ... Silly TESH, I wish it could highlight everything between " " :/

My TESH does... try playing with its options... :O<<
 

Bribe

vJass errors are legion
Reaction score
67
So the missing endquote was what messed up your code.

However, the first thing which came to mind was:

JASS:
if (true)
{
    DoNothing();
}


That has not compiled for me in the past. Zinc has a bug on my computer when inserting only a single element into curly brackets within an if block and JassHelper refuses to compile it.
 

Ashlebede

New Member
Reaction score
43
However, the first thing which came to mind was:

JASS:
if (true)
{
    DoNothing();
}


That has not compiled for me in the past. Zinc has a bug on my computer when inserting only a single element into curly brackets within an if block and JassHelper refuses to compile it.

Did you try without curly brackets?

JASS:
if(true) DoNothing();


Weird syntax, but it is compiled just like curly brackets if there is only 1 element, just like in C. Maybe that would work for you... >>D:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top