Home AMX User Forum NetLinx Studio

Illegal or invalid syntax in code.. on a valid function (i think)

define_function sinteger billy_jean_is_crazy(char jeans, char billies[], _bji_do_something kab_data) {
    long bj;
    sinteger bb;
    
    bj = 2;
    bb = string_to_variable(kab_data, billies, bj);
    
    if(bb <> 0) {
	xmen(devi, you, "'you #!@U%!*@',itoa(jeans),', haha ',itoa(bb)");
    }
    return bb;
}

I get the following:
----------------- Starting Netlinx Compile - Version[2.5.2.20] [12-23-2009 13:48:35] ---------------------
C:\amx\module.axs
ERROR: C:\amx\module.axs(1031): C10201: Syntax error; Illegal or invalid syntax in code
C:\amx\module.axs - 1 error(s), 0 warning(s)
NetLinx Compile Complete [12-23-2009 13:48:36]



strangly enough if I write any other function it does work (so I'm sure it's in the actual function, not in the functions above or anything)

the line it highlights is sinteger bb; curiously enough it highlights long bj; when I move the opening { down.

It seriously has me puzzled. I hope someone here can help me figure it out.

btw this is what it says in the help file for define_function
DEFINE_FUNCTION [<return type>]<name>[(<param1>,<param2>,...<parameN>)]
{
(*statements *)
}

Comments

  • jjamesjjames Posts: 2,908
    define_function sinteger billy_jean_is_crazy(char jeans, char billies[], [b]_bji_do_something kab_data[/b])
    

    Are these supposed to be two separate parameters, or is "_bji_do_something" a structure?
  • Jorde_VJorde_V Posts: 393
    jjames wrote: »
    define_function sinteger billy_jean_is_crazy(char jeans, char billies[], [b]_bji_do_something kab_data[/b])
    

    Are these supposed to be two separate parameters, or is "_bji_do_something" a structure?

    it's a structure yes

    Edit: and that reminded me to check the bloody structure, and obviously I made a little typo there xD. (As the japanese would say: '馬鹿!')
  • dchristodchristo Posts: 177
    Have you tried adding the keyword LOCAL_VAR to the variable definition?
    define_function sinteger billy_jean_is_crazy(char jeans, char billies[], _bji_do_something kab_data) {
        LOCAL_VAR long bj;
        LOCAL_VAR sinteger bb;
        
        bj = 2;
        bb = string_to_variable(kab_data, billies, bj);
        
        if(bb <> 0) {
    	xmen(devi, you, "'you #!@U%!*@',itoa(jeans),', haha ',itoa(bb)");
        }
        return bb;
    }
    
Sign In or Register to comment.