Home   Help Search Login Register  

Author Topic: The old Lampost puzzle  (Read 583 times)

0 Members and 1 Guest are viewing this topic.

Judge856

  • Guest
The old Lampost puzzle
« on: 01 May 2003, 02:38:13 »
Hey, I was searching how to turn lamposts or streetlamps on in Res and heres what I found in the command Referance...

Description:
Check if lampost is on (shining). Possible values are "ON", "OFF", "AUTO" (auto is shining during the night).

Example:
lightIsOn nearestObject [player, "StreetLamp"] != "OFF"


Problem is I don't understand the bold type stuff. Say playername = John, Streetlightname=S1(or global variably would be nice :))

Can anyone give me and example and explain the bold type cos im not too good at scripting :(

Anthrid

  • Guest
Re:The old Lampost puzzle
« Reply #1 on: 01 May 2003, 03:26:32 »
I need that question answered also. The command reference thing doesn't clearly explain ur commands, only gives it  :(

deaddog

  • Guest
Re:The old Lampost puzzle
« Reply #2 on: 01 May 2003, 03:34:34 »
"player" is actually a statement (or command).  It returns a reference to the players unit, regardless of it's name.

If your player is named "John" then:

vehicle john
    is the same as
vehicle player

This way you don't have to keep track of the name of the player.

So "nearestObject [player, "StreetLamp"] " returns a reference to the streetlamp object that is closest to the player.

You could also write this as:
nearestObject [john, "StreetLamp"]


the whole statement:
lightIsOn nearestObject [player, "StreetLamp"] != "OFF"

checks to see if the streetlamp closest to the player is something other than "off".

You could use this whole statement in a triggers condition field, for example

That help any or did I totally screw that explanation up?  :)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:The old Lampost puzzle
« Reply #3 on: 01 May 2003, 13:54:34 »
The problem with the command ref is the problem that any dictionary has - it can only define words in the dictionary using words in the dictionary ..... I strongly recommend that you read the command ref from front to back, like a book.  Don't try to remember everything but it will just give you a better idea of what is there and how it all fits together.

In this you can make the whole thing simpler.   The example is confusing because it combines several commands.  

Another example is

object 1234 switchlight "on"

If you click on Show IDs and zoom right in you will see the ID numbers for every object on the map.    Streetlamps aren't marked on the map - although the IDs are - so  you will have to Preview the mission to check you have the right one.    The command

object xxxx

returns the object with that ID.    Switchlight switches the lamp on or off or whatever, in the same way that lampison checks its status.

Hope that helps.

Btw Judge856, please don't send me IMs on forum questions.   If you post here you get the benefit of a quicker response and everybody's knowledge, not just mine.   More importantly, other people (like Anthrid) can see both the question and the answer. ;)
Plenty of reviewed ArmA missions for you to play