Home   Help Search Login Register  

Author Topic: OnMapSingleClick - Difference in ArmA?  (Read 4079 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

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Re: OnMapSingleClick - Difference in ArmA?
« Reply #15 on: 31 Jul 2007, 03:02:11 »
Hi, I am having the same problems with onmapsingleclick, but I can't deduce a solution from this thread, maybe I am blind. :dry:

What I am trying to do is to dynamically command a heli around the map.

onMapSingleClick "Luft1 move _pos;  onMapSingleClick {}";

works, but gives me the infamous "type code, expected string" error message.


Where is the fault?

Cheers, Mathias

Offline firecontrol

  • Members
  • *
Re: OnMapSingleClick - Difference in ArmA?
« Reply #16 on: 31 Jul 2007, 07:37:50 »
onMapSingleClick "Luft1 move _pos; onMapSingleClick """"";

???
That's 5 of the " quotation marks at the end, btw.
Just a shot in the dark here. That example in the wiki may not work, as onMapSingleClick "" is used to disable it, not {}.

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Re: OnMapSingleClick - Difference in ArmA?
« Reply #17 on: 31 Jul 2007, 12:29:41 »
Wow, that's it, the error is gone!

Looks like you are really accurate when shooting in the dark.  :D

Many thanks,

Mathias