Home   Help Search Login Register  

Author Topic: Problem with "gridcoord" function  (Read 764 times)

0 Members and 1 Guest are viewing this topic.

Coyote @ rage

  • Guest
Problem with "gridcoord" function
« 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

« Last Edit: 16 Jan 2003, 14:37:34 by Coyote @ rage »

Offline uiox

  • Contributing Member
  • **
Re:Problem with "gridcoord" function
« Reply #1 on: 16 Jan 2003, 15:22:37 »
Hi

playerposit = [getpos player] call GridCoord; hint format ["Position: %1", playerposit];

It's the correct syntax. Will cahge it in the example.

Sorry.

Coyote @ rage

  • Guest
Re:Problem with "gridcoord" function
« Reply #2 on: 16 Jan 2003, 15:53:26 »
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!
« Last Edit: 16 Jan 2003, 16:07:21 by Coyote @ rage »

Offline uiox

  • Contributing Member
  • **
Re:Problem with "gridcoord" function
« Reply #3 on: 16 Jan 2003, 17:36:25 »
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"
« Last Edit: 16 Jan 2003, 17:38:09 by uiox »

Coyote @ rage

  • Guest
Re:Problem with "gridcoord" function
« Reply #4 on: 16 Jan 2003, 17:50:01 »
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.

Offline uiox

  • Contributing Member
  • **
Re:Problem with "gridcoord" function
« Reply #5 on: 16 Jan 2003, 18:14:05 »
New version download.

Coyote @ rage

  • Guest
Re:Problem with "gridcoord" function
« Reply #6 on: 16 Jan 2003, 18:37:56 »
...like a charme.



TY
« Last Edit: 16 Jan 2003, 18:38:51 by Coyote @ rage »