Home   Help Search Login Register  

Author Topic: If..then..else dumb question  (Read 472 times)

0 Members and 1 Guest are viewing this topic.

Ade

  • Guest
If..then..else dumb question
« on: 04 Sep 2003, 20:54:08 »
Bear with me becauseI have been mission editing for less than a week...
Using OFPR 1.91

Looking in the official comref, my understanding of how to build an if..then statement is that you do it like this:

if (condition) then [{action1},{action2}]

But looking around the forum for posts, I've noticed people using:

?_condition ...

Can someone please tell me what the correct struture is?

Cheers,
Ade ???

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:If..then..else dumb question
« Reply #1 on: 04 Sep 2003, 21:22:31 »
They are both correct.

the:

?condition:dosomething

has allways been supported by OFP

if (condition) then {dosometihng} else {do somethinglese}

was added in 1.85, and adds alot of flexibilty - as you have the "else" part wich allows you to also nest them (see this) FAQ item
« Last Edit: 04 Sep 2003, 21:24:18 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Ade

  • Guest
Re:If..then..else dumb question
« Reply #2 on: 04 Sep 2003, 21:30:00 »
Thanks Toad,

That's cleared that one up.  Now on with the script!

Ade  :thumbsup:

Harkonin

  • Guest
Re:If..then..else dumb question
« Reply #3 on: 04 Sep 2003, 23:27:50 »
Heres a question for you Toad, I have a script for back blast and effects right.
Was a pain to get weapon specific, now however I want it to be "Law" or "RPG"

Here it is as is:

_man=_this select 0
_object=nearestobject [_man,"Law"]
_pos=getpos _object
_lifeTime =35
_delay = 0.001
_velocity=[0,0,1]
_lifeTicks = _lifeTime / _delay
_lifeTick = _lifeTicks

now how can I get "RPG" and "LAW" into the same array?

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:If..then..else dumb question
« Reply #4 on: 05 Sep 2003, 01:37:57 »
Ask this question in it's own thread and Ill answer it.  ;)
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

gadolinite

  • Guest
Re:If..then..else dumb question
« Reply #5 on: 05 Sep 2003, 03:20:27 »
Quote
if (condition) then {dosometihng} else {do somethinglese}

 :toocool:Yeah Baby, thats how u do it, the C++ way:toocool: