Home   Help Search Login Register  

Author Topic: OnMapSingleClick - Difference in ArmA?  (Read 4550 times)

0 Members and 1 Guest are viewing this topic.

Offline Case

  • Members
  • *
OnMapSingleClick - Difference in ArmA?
« on: 11 May 2007, 19:10:51 »
Is there a change in how the OnMapSingleClick command works in ArmA?

I am getting an error 'type code, expected string'.

Originally, I was trying to get Skumbag's airstrike script working and got this, but I even get it when using the example code from the comref (ie. onMapSingleClick {"SoldierWB" createUnit [_pos, group player]; true}  ).

I also searched the forums here and couldn't find mention of any change.

Is anyone else having this problem, and is there a simple fix that I just need to my syntax for this command?

My apologies if this has been answered before.

Thanks!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: OnMapSingleClick - Difference in ArmA?
« Reply #1 on: 11 May 2007, 19:33:06 »
try removing the { and } brackets.

If you get errors try putting [ and ] where the { and } was.

{ } have been changed. They used to be strings and now they are code.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: OnMapSingleClick - Difference in ArmA?
« Reply #2 on: 11 May 2007, 19:36:26 »
Yes, indeed now onMapSingleClick uses "" instead of {}..

Code: [Select]
onMapSingleClick """SoldierWB"" createUnit [_pos, group player]; true"
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Case

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #3 on: 11 May 2007, 20:25:11 »
Thank you to both.

I have the sample script working fine (generating a soldier on map click), but am still getting an error on the airstrike script.

Here is what I have:

radio activation:  onMapSingleClick "[_pos] exec 'airstrike.sqs';"

This seems to call the script now, and I am able to click on the map.  As soon as I click on the map, I get the error:

onmapsingleclick
error onmapsingleclick: type code, expected string

But, it looks like it does start running the script.  There is some sidechat, and some extra 'test #' that I put in for debugging.  It looks like it runs "on the way", and "test 1". then stops.

Here is the code (slightly modified) from Scumbag's script:

Code: [Select]
onMapSingleClick {}
1 setRadioMsg "Null"

_pos = _this select 0

"target" setMarkerPos _pos
"target" setMarkerType "destroy"

strikePlane = "A10LGB" camCreate (getMarkerPos "spawn")
strikePlane setPos [(getPos strikePlane select 0),(getPos strikePlane select 1),(getPos strikePlane

select 2)+800]
strikePlane setDir 180

strikePilot assignAsDriver strikePlane
strikePilot moveInDriver strikePlane
strikePilot doMove _pos
strikePilot sideChat "On the way"

strikePilot sideChat "test 1"
@ unitReady strikePilot
strikePilot sideChat "Target aquired"

strikePilot sideChat "test2"
_num = 4
_i = 0

#loop
_bomb = "laserGuidedBomb" camCreate [(getPos strikePlane select 0)+((random 10)-5),(getPos strikePlane

select 1)+((random 10)-5),(getPos strikePlane select 2)-3]
_bomb setDir (getDir strikePlane)
_bomb setVelocity [(velocity strikePlane select 0)*0.2,(velocity strikePlane select 1)*0.2,(velocity

strikePlane select 2)*0.2]
_i = _i + 1
~0.2
? _i < _num : goto "loop"

strikePilot doMove (getMarkerPos "spawn")
strikePilot sideChat "Heading back"

"target" setMarkerType "empty"

@ unitReady strikePilot
strikePilot sideChat "in unitready"
deleteVehicle strikePlane
strikePilot sideChat "test 4"
strikePilot setVelocity [0,0,0]
strikePilot sideChat "test 5"
strikePilot setPos (getMarkerPos "safe")
strikePilot sideChat "test 6"
strikePilot sideChat "Ready"

1 setRadioMsg "Air Strike"

exit

Any more ideas?

Again, much thanks.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: OnMapSingleClick - Difference in ArmA?
« Reply #4 on: 11 May 2007, 20:51:20 »
Try
Code: [Select]
onMapSingleClick "[_pos] exec ""airstrike.sqs"""
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: OnMapSingleClick - Difference in ArmA?
« Reply #5 on: 11 May 2007, 21:56:00 »
I find it very strange that onMapSingleClick requires quotes. It is completely inconsistent since everything that is code should be in braces, and what follows onMapSingleClick sure looks like code to me. Another little fuckup.
urp!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: OnMapSingleClick - Difference in ArmA?
« Reply #6 on: 11 May 2007, 22:10:14 »
Quote
loveup.
:D


In OFP { was the same as "" so basicly onMapSingleClick used to be a string in OFP as well.
Using { with strings enabled the 'strings within strings' which now has to be done with multiple "..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Case

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #7 on: 11 May 2007, 23:04:10 »
Copied and pasted your code.

I get the same error, specifically:

Code: [Select]
'|#|onmapsingleclick {}'
error onmapsingleclick: type code, expected string

Anything else that looks suspicious in the airstrike.sqs code above?  It does look like it starts to execute it now...

Thanks!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: OnMapSingleClick - Difference in ArmA?
« Reply #8 on: 12 May 2007, 00:11:40 »
Ah, it's propably the mapclick line in the script giving the error now..

Change the first line of the script from
Code: [Select]
onMapSingleClick {}to
Code: [Select]
onMapSingleClick ""
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Case

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #9 on: 12 May 2007, 01:35:55 »
That looks like the problem.  No error now, but the airstrike never happens.

I will just mess around with it a bit to get it working.  In the meantime, I was playing with 'mr murray's' airstrike, and got that one to work if this one is a no-go for me.

Again, thanks for the help.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: OnMapSingleClick - Difference in ArmA?
« Reply #10 on: 12 May 2007, 01:46:29 »
There are many things 'wrong' in the script, including for example the line
Code: [Select]
strikePlane = "A10LGB" camCreate (getMarkerPos "spawn")propably does nothing if the class name of the A-10 in the 1.07 beta (or in the US version) is not A10LGB

Also the LGB is no longer named LaserGuidedBomb so this line
Code: [Select]
_bomb = "laserGuidedBomb" camCreate [(getPos strikePlane select 0)+((random 10)-5),(getPos strikePlane
also does nothing.

Furthermore, nothing else than cameras seem to be creatable by using camCreate in ArmA, you need to use createVehicle or createVehicleLocal instead..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Case

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #11 on: 12 May 2007, 05:57:20 »
h,

Thanks again for your help.

I found the community.bistudio.com website reference for Armed Assault, and you are correct, the A-10 class name is 'A10', so that wouldn't have worked.

I have decided to work with 'mr. murray's' script, as it is working for me now and I can just tweak it to how I want it to specifically work.

Thank you for the help with the onmapsingleclick though, I will still be using it for other functionality in the mission I am working on.

Cheers!

Offline D_P_

  • Members
  • *
  • YAY! I'm a lama again! ...oh wait.
    • ArmaAddons
Re: OnMapSingleClick - Difference in ArmA?
« Reply #12 on: 12 May 2007, 22:57:09 »
ya mind posting a demo mission with the working script?  :D
just setpos & forgetpos!

Offline Case

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #13 on: 12 May 2007, 23:28:45 »
If you mean 'Mr. Murray's airstrike script, I got it from here:  http://www.djkane.de/armafiles/airstrike-example_mr-murray.rar

I am pretty sure it just worked 'out of the box'.

Try it out, and if it doesn't work, I will compare it to what I have now.

Cheers!

Offline dematti

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #14 on: 11 Jun 2007, 23:01:06 »
does not work in 1.08