function identify criteria

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

function identify criteria

Post by DevGIB »

i always get Expected an identifier, got User Function send_attack instead.
regardless of what i do i cant seem to get rid of it...

whats the criteria to naming a function...

here i was thinking that can_cast would be orright :S
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post by CWO »

I would just rename all instances of send_attack to something completely different. If I recall correctly, I'm thinking this is because you might have a variable and a function with the same name... not sure...
Beaud
Novice Poster
Posts: 41
Joined: Tue Feb 14, 2006 2:06 pm
Location: Québec, Canada

Post by Beaud »

Indeed, duplicated Function; watch for includes.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

had a feeling it might be that... thanks guys :)
daneel
New User
Posts: 12
Joined: Fri Feb 03, 2006 5:47 am
Contact:

Post by daneel »

It reports a conflict both when finding a function whose name is the same of another function, or even a parameter of a function whose name equals another function's (in the scope). I know that from experience :P

So for example if you try to compile this:

Code: Select all

// scripts/textcmd/gm/myscript.src

use uo;

program my_script(target)

   sendsysmessage(target, "you wrote .myscript and you have at least gm rights.");

endprogram
you'll get such error, precisely this:

Code: Select all

Compiling: <POLPATH>\scripts\textcmd\gm\myscript.src
Expected arguments or right-paren in program arglist, got 'Func(2,0): target'
Error detected in program body.
Error occurred at <POLPATH>\textcmd\gm\myscript.src, Line 4
of course because a function named "target" exists in the scope (UO.em).

PS: obviously it won't tell you the same if if finds two arguments of two different functions in the scope having the same name.. the conflict matching occurs in these two cases:
1. function name <--> function name
2. function's parameter name <--> function name
Exar Kun
Novice Poster
Posts: 42
Joined: Wed Apr 19, 2006 12:29 pm
Location: St. Peters, MO

Thanks gang.

Post by Exar Kun »

The Search function DOES work.
Post Reply