HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What am I doing wrong with this? jass?

09-23-2006, 02:36 AM#1
Fr0zenLord
Im not sure, I get an error expected "(" im not sure why
I copied the tutorial exactly, (Im sure I did)
Its the call AddSubtract takes(a,b) part, it highlights that line and says "expected a "(" , can someone tell me my fault?
Collapse JASS:
function Message takes string s returns nothing
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, s )
endfunction

function AddSubtract takes integer a, integer b returns nothing
    set udg_r1 = a+b
    set udg_r2 = a-b
endfunction

function Message_Actions takes nothing returns nothing
 local integer a = 21
 local integer b = 56
     call AddSubtract takes(a,b)
     call Message("a = "+I2S(a))
     call Message("b = "+I2S(b))
     call Message("The Addition is "+I2S(udg_r1))
     call Message("The Subtraction is "+I2S(udg_r2))
endfunction
//===========================================================================
function InitTrig_Message takes nothing returns nothing
    set gg_trg_Message = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Message, Player(0) )
    call TriggerAddAction( gg_trg_Message, function Message )
endfunction

thanks in advance
09-23-2006, 02:38 AM#2
Vexorian
Quote:
call AddSubtract takes(a,b)
Highly doubt you copied the tutorial exactly, (remove the takes)
09-23-2006, 02:50 AM#3
Fr0zenLord
Ok?, it did say "takes" there though -.-
Collapse JASS:
function Trig_JASS_test_Actions takes nothing returns nothing
 local integer a=14
 local integer b=56
    call AddSubstract takes(a,b)
    call Msg("a= "+I2S(a))
    call Msg("b= "+I2S(b))
    call Msg("The Addition is "+I2S(udg_r1))
    call Msg("The Substraction is "+I2S(udg_r2))
endfunction

thats from tutorial, maybe I mis-read and you named the function AddSubstract takes or something, o well, thanks XD

OMG I still found a way to crash it...!
Collapse JASS:
function Message takes string s returns nothing
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, s )
endfunction

function AddSubstract takes integer a, integer b returns nothing
    set udg_r1 = a+b
    set udg_r2 = a-b
endfunction

function Message_Actions takes nothing returns nothing
 local integer a = 21
 local integer b = 56
     call AddSubstract (a,b)
     call Message("a = "+I2S(a))
     call Message("b = "+I2S(b))
     call Message("The Addition is "+I2S(udg_r1))
     call Message("The Subtraction is "+I2S(udg_r2))
endfunction
//===========================================================================
function InitTrig_Message takes nothing returns nothing
    set gg_trg_Message = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Message, Player(0) )
    call TriggerAddAction( gg_trg_Message, function Message )
endfunction

ugh,sorry to be a continuous bother lol
09-23-2006, 03:04 AM#4
Vexorian
can't believe no one found that flaw till today, maybe the thing got corrupted or something , I am fixing the tutorial anyways.

It crashes because you keep changing the friggin names of the functions for no reason.

In the trigger I am using function Trig_JASS_test_Actions takes nothing returns nothing , and you are not supposed to change the contents of InitTrig_JASS_test_Actions in none of the tests, why are you changing the content? And the reason of the crash is that you are using function Message , but function Message takes a string, you made the same mistake as with the other time. If you really wanted to change the function's name to Message_Actions then you should have used function Message_Actions on the call to TriggerAddAction
09-23-2006, 03:26 AM#5
Fr0zenLord
Ty, I see, works now XD, why am I changing the contents, I dunno I have about 8 triggers now, with names, so I change the names of them...

e.g I have a trigger called Msg, MSG, Message, etc.. I dont wanna use the same name twice... im making a little section in world editor, with list of all the stuff I learn, so when I need to find something I can go back to it... (I forget stuff alot, -.-), o well thanks again
09-23-2006, 03:36 AM#6
Vexorian
you could just disable the previous versions
09-23-2006, 03:56 AM#7
Fr0zenLord
I have, -.- Lolz I disable them as I go, otherwise i'd have about, 20 lines of text on my screen per second XD, Didnt know I could reuse em XD ty
09-23-2006, 07:30 AM#8
Fireeye
Uhm, as much as i looked this is the error:
Collapse JASS:
    call TriggerAddAction( gg_trg_Message, function Message )
because the function you want to call is
Collapse JASS:
function Message_Actions takes nothing returns nothing
and not the message function, because it takes something.

---Edit---
Ops, didn't read excatly, well, shit happens