OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Coyote @ rage on 16 Jan 2003, 14:36:41
-
I feel kinda stupid asking, but I canÂ't do the syntax of functions, yet.
I want to implement the gridcoord function by uiox in a Multiplayer map. I followed the instructions exactly:
Put this in init.sqs : GridCoord = preprocessFile "gridcoord.sqf"
Then I made trigger activated repeatedly by radio and at "On activation" I put:
playerposit = getpos player call GridCoord; hint format ["Position: %1", playerposit];
Alas, when I radio the trigger in preview, I get an error message at this line:
_GrandeLettre = (((_Pos select 0) - [error shows here]((_Pos select 0) Mod 1280))/1280);
[error shows here] is where the # thingy comes up. Then it does like 50 spaces in the error message and I can see the beginning of the next line on the far right, going off the screen.
I tried some things with the syntax, but there donÂ't appear to be a bracket or sth wrong.
I reckon itÂ's either a syntax error that (still) dumb windows user that is used to OFP scripting syntax (myself) canÂ't figure out or the way I call the function is wrong.
Getting into function syntax tutorial myself at the weekend, but any help would be greatly appreciated and could get me started on getting into functions.
Cheers Coyote @ rage
-
Hi
playerposit = [getpos player] call GridCoord; hint format ["Position: %1", playerposit];
It's the correct syntax. Will cahge it in the example.
Sorry.
-
No problem at all, in fact, in your example you wrote sth completely different, the "playerposit" variable is just what I used to hint the posit.
Adding the brackets solved my above problem, but now I get a generic error message at the end of second to last line (result......)
Guess I need more help?!?
Ahem..IÂ'll give it a shot:
If IÂ'm not mistaken, then here:
If (_Chiffre < 10) then {_Chiffrestring = "0" + _Chiffrestring };
You are adding two strings?
Newbie Question: Can You do that?
Feel free to move this out of advanced scripting into more noob section, really sorry!
-
Re-Sorry
A bug in the script.
I post a new version in editor depot.
:-[
For string
stringA + stringB
Operand types:
stringA: String
stringB: String
Type of returned value:
String
Description:
stringA and stringB concatenated
Example:
"I" + " am" + " sorry" , result is "I am sorry"
-
Re no problem at all.
IÂ'll wait for new version of your function.
Thanks a lot for string lesson. Really wasnÂ't aware of that.
-
New version download.
-
...like a charme.
TY