HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

function interface problem

04-28-2007, 03:58 PM#1
MaD[Lion]
Collapse JASS:
//FUNCTION INTERFACE FOR CONDITIONAL FUNCTIONS
function interface ConditionalFunction takes nothing returns nothing
...
function BasicBounce takes nothing returns nothing
    local integer Mi = OOMS_CurrentMotionObject
    local motion M = OOMS_MotionObjects[Mi]
    local particle p = M.Particle
    local unit P = p.Unit
    ....
endfunction
...
function something takes nothing returns nothing
    local ConditionalFunction F = ConditionalFunction.BasicBounce
endfunction

I compiled this and got error at where i declare local ConditionalFunction F:
ConditionalFunction is not type that allow . syntax

what have i done wrong?
04-28-2007, 05:42 PM#2
blu_da_noob
Edit: Oh wait, nevermind. You actually seem to have no idea how to create interfaces. Read the goddamn readme.
04-28-2007, 05:43 PM#3
MaD[Lion]
brackets??? what u mean :P

Here is example from vJass documentation, i dont see anything wrong:
Collapse JASS:
function interface Arealfunction takes real x returns real

function double takes real x returns real
    return x*2.0
endfunction

function triple takes real x returns real
    return x*2.0
endfunction

function Test1 takes real x, Arealfunction F returns real
    return F.evaluate(F.evaluate(x)*F.evaluate(x))
endfunction

function Test2 takes nothing returns nothing
 local Arealfunction fun = Arealfunction.double //syntax to get pointer to function

   call BJDebugMsg( R2S(  Test1(1.2, fun) ))

   call BJDebugMsg( R2S(  Test1(1.2, Arealfunction.triple ) )) //also possible...
endfunction
04-28-2007, 05:56 PM#4
blu_da_noob
Aah, I'm looking at plain interfaces. Based on function interfaces that looks ok, so *summon Vex*.

Edit: Just to check, have you tried changing the name of your function interface?
04-28-2007, 06:11 PM#5
MaD[Lion]
no, i may try, there may be function shadowing problem

a nvm, i figured it out
04-29-2007, 03:09 PM#6
Ammorth
I tried to help and see if I could find a problem, but for some reason, every time I tried to save a map, it would crash while trying to parser the map...

I think your problem may be that you are taking nothing. Not sure though.
04-29-2007, 03:12 PM#7
Vexorian
code seems correct to me, did you end up fixing the problem?
04-29-2007, 06:32 PM#8
MaD[Lion]
ye, it was just i forgot to declare the interface :P I tho i have copy pasted the new engine code with the declaration. Stupid me :P