• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] vJass Syntax Checker

Status
Not open for further replies.
Level 7
Joined
Mar 22, 2010
Messages
228
JASS:
scope stupid initializer you_are

    globals
        private constant integer MY_AGE = 16
    endglobals

        private function condition takes nothing returns boolean
            debug call DisplayTextToPlayer(player(0), 0, 0, SCOPE_PREFIX+I2S(MY_AGE))
            return false
        endfunction

        private function you_are takes nothing returns nothing
            local trigger t = CreateTrigger(  )
            call TriggerAddCondition(t, Condition(function condition)
            debug call BJDebugMsg(SCOPE_PREFIX+"oh yes")
        endfunction

endscope

this stupid script wont work!!! even with the simplest form of scope i cant do it T_T ITS SO STUPID!
comment please
 
Last edited by a moderator:
First, what's up with this?
JASS:
function InitTrig_Melee_Initialization takes nothing returns nothing
endfunction

You forgot the call keyword
TriggerAddCondition(t, Condition(function condition)

Also, you have to actually do TriggerEvaluate

JASS:
        private function you_are takes nothing returns nothing
            local trigger t = CreateTrigger(  )
            call TriggerAddCondition(t, Condition(function condition)
            call TriggerEvaluate(t)
            debug call BJDebugMsg(SCOPE_PREFIX+"oh yes")
        endfunction
 
Level 7
Joined
Mar 22, 2010
Messages
228
oh sh*t..there i edited it..

and i will remove the unused function..
i did that because i saw one using it XD

so whats lacking?

how to triggerevaluate?

EDIT: with the triggerEvaluate still didnt work..

this is now the script

JASS:
scope Stupid initializer You

globals
    private constant integer MY_AGE = 16
endglobals

private function Con takes nothing returns boolean
    debug call DisplayTextToPlayer(player(0), 0, 0, SCOPE_PREFIX+I2S(MY_AGE))
    return false
endfunction

private function You takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddCondition(t, Condition(function Con)
    call TriggerEvaluate(t)
    debug call BJDebugMsg(SCOPE_PREFIX+"oh yes")
endfunction

endscope
 
Well, you never really want to use scope or library initializers. You can do it in some cases, but in most cases you want to use a module initializer, or at the least a struct initializer. A struct initializer is also easier to write. See my response to your globals thread for an example.

And the first letter of functions should be capitalized. Also _ is only used in constants, otherwise it's camel casing.

YouAre
Condition

edit
call TriggerEvaluate(t)

edit
Exact working code..
JASS:
private function you_are takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerAddCondition(t, Condition(function condition))
    call TriggerEvaluate(t)
    debug call BJDebugMsg(SCOPE_PREFIX+"oh yes")
endfunction

And make sure debug mode is on since you have the debug stuff in there.

edit
You are missing a )
 
Level 7
Joined
Mar 22, 2010
Messages
228
JASS:
scope Stupid initializer You

globals
    private constant integer MY_AGE = 16
endglobals

private function Con takes nothing returns boolean
    debug call DisplayTextToPlayer(Player(0), 0, 0, SCOPE_PREFIX+I2S(MY_AGE))
    return false
endfunction

private function You takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddCondition(t, Condition(function Con))
    call TriggerEvaluate(t)
    debug call BJDebugMsg(SCOPE_PREFIX+"oh yes")
endfunction

endscope

i did all you said..but it still didnt work
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
And the first letter of functions should be capitalized. Also _ is only used in constants, otherwise it's camel casing.

Yea that's wrong. There is no book that says the first letter of a function should be capitalized. That's just your preference.

See my response to your globals thread for an example.

If you read the [vJASS] globals thread he says "I didn't understand anything" like 4 times. It really isn't useful to explain the benefits of having struct initializers to someone who doesn't understand what a struct is.

You didn't even establish what he was trying to do with the script before giving him pointers about how to capitalize function names.

So. machris13. What exactly is this script supposed to do? You just want it to display the scope name and then your age? It would also be helpful if you provided some information on what exactly doesn't work and give us some information on the errors that are showing up when it doesn't work. Simply saying "it doesn't work" means absolutely nothing in computer programming.

I have a feeling the problem is that you're not running WarCraft III NewGen in DEBUG mode. All of your visible code executions (like displaying text) are given the debug keyword so they will only be executed when NewGen is testing the map in DEBUG mode.

You have so many syntax errors I normally don't look for because I don't make syntax errors anymore >.>. I only look for logical errors automatically, hence why I noticed TriggerEvaluate missing before anything else ;D.

You can stop flexing now, Nestharus.
 
Level 7
Joined
Mar 22, 2010
Messages
228
player(0) should be Player(0)

You have so many syntax errors I normally don't look for because I don't make syntax errors anymore >.>. I only look for logical errors automatically, hence why I noticed TriggerEvaluate missing before anything else ;D.

:goblin_cry: most mistakes of mine you stated were mis typed :goblin_cry:

any more mistakes?
please let me understand this stupidity :goblin_cry:

EDIT: my debug is on, the script was made just to clarify some nasty questions, and so that everything will be clear..
 
Last edited by a moderator:
Level 18
Joined
Jan 21, 2006
Messages
2,552
I already told him that Berb >.>. It's the syntax errors that were his problem, something I normally don't notice at all =).

Yea that player(0) really skipped me, but machris13 in the future be far more specific. The thread is titled "is this insane" and the only information you give is "it doesn't work". If it was giving you syntax errors then it would clearly say you have syntax errors - in which case we on the forum know where to look for your mistakes.

Don't be ignorant.
 
Nop, it runs now.

And here is how people typically format code.

JASS:
scope Stupid initializer You
    globals
        private constant integer MY_AGE = 16
    endglobals
    
    private function Con takes nothing returns boolean
        debug call DisplayTextToPlayer(Player(0), 0, 0, SCOPE_PREFIX+I2S(MY_AGE))
        return false
    endfunction
    
    private function You takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerAddCondition(t, Condition(function Con))
        call TriggerEvaluate(t)
        debug call BJDebugMsg(SCOPE_PREFIX+"oh yes")
    endfunction
endscope
 
Level 7
Joined
Mar 22, 2010
Messages
228
and oh the problem with the map is i cant start it.. not the trigger only..

i need to sleep now.. its 4:30 AM here
 
Level 7
Joined
Mar 22, 2010
Messages
228
OH it worked!!!!!!!!! :D stupid script took me almost hour !!! thanks alot guys!!!!:D




Don't be ignorant.
what is more specific than saying it doesnt work?

go think
 
Last edited by a moderator:
Level 18
Joined
Jan 21, 2006
Messages
2,552
It took an hour because you didn't tell us anything.

Hit save then test map... not just test map.

If you had told Nestharus the problem earlier, he would've given you this advice earlier. There is a reason that the error dialog pops up and tells you what the problem is.
 
Level 7
Joined
Mar 22, 2010
Messages
228
actually even working scripts give me syntax errors.. so what should i care?

you want me to say it gave me syntax errors...?

why? coz it doesnt work =_=

stop this argue im goin to sleep
 
Level 13
Joined
May 11, 2008
Messages
1,198
he is obviously checking for syntax errors by clicking that button that doesn't work in jgnp in the trigger editor that you see with your custom text. yes, save map to check for errors. it might not be 100 percent reliable, but you can learn patterns and backtracking to fix the errors that come up.

when you go save map then jasshelper compiles your code for you. if there is an error then, then you have to try to fix it. otherwise, you can test the map.

funny i had the same problem when first used jngp but it was long ago.
 
Status
Not open for further replies.
Top