Home   Help Search Login Register  

Author Topic: looking for an old article  (Read 1433 times)

0 Members and 1 Guest are viewing this topic.

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
looking for an old article
« on: 13 Feb 2004, 03:55:04 »
i remember seeing an article in the editing depot that compared ofp's scripting language to C++.  i cant find it now, and my friend was curious to see it.  i think snYpir wrote it, but im not sure.

anyway, does anyone know where i can find it?  or was it deleted somehow?
« Last Edit: 13 Feb 2004, 03:55:23 by .pablo. »

deaddog

  • Guest
Re:looking for an old article
« Reply #1 on: 13 Feb 2004, 04:20:50 »
OFPs scripting language is nothing like C++.  It's more like BASIC.

It comes remotely close in the config.cpp files in the use of classes but OFP's version is vastly simplified.  But the config.cpp file is not the same as the scripts we write.
« Last Edit: 13 Feb 2004, 04:24:10 by deaddog »

Offline Kuro

  • Former Staff
  • ****
  • 2./FschJgBtl 251 Green Devils
    • VBS2 Mission Download Site
Re:looking for an old article
« Reply #2 on: 13 Feb 2004, 05:54:36 »
Well,

i think the OFP script language is a mixture the basic concept is clearly C++ but some commandos make it look like BASIC. IMHO it is a mixture.

Homefry31464

  • Guest
Re:looking for an old article
« Reply #3 on: 13 Feb 2004, 05:57:10 »
I think I remember this as well, but I thought the article had something to do with functions... Not sure though.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:looking for an old article
« Reply #4 on: 13 Feb 2004, 10:31:12 »
OFP functions are like C. The tutorial on writing functions by SnYpir is what your looking for.

http://www.ofpec.com/editors/resource_view.php?id=126
http://www.ofpec.com/editors/resource_view.php?id=128

"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:looking for an old article
« Reply #5 on: 13 Feb 2004, 14:12:44 »
toadlife -- those links were the first ones i checked, but i remember the article specifically "translating" lines from ofp to c++

i tried searching google again and im pretty sure this is the one (it wasn't by snYpir):

http://ofpcinematic.operation-flashpoint.de/download/Cutscenes.doc

Quote
(Note 2) At the end there's a line of code that will let you watch the whole fight. This is the most powerful thing in scripting. You can simulate any C or Basic statement with this. IF-THEN, WHILE, FOR anything.
In this case I wait for either the prisoner or the three soviets to be killed before I end the scene.

? (Alive res_prisoner) && (Alive off2 or Alive off3 or Alive man4) : goto "fightloop"

In plain english this line means: IF (prisoner is alive) AND (one of more of the soviets are alive) keep watching.
This is actually a simulated WHILE loop in C/C++.

In C++ this would have been:

while (res_prisoner.Alive() && (off2.Alive() || off3.Alive() || man4.Alive())
  sleep(1);

FOR loops are also easy to make, but they need a bit of extra work. Let's say you want four magazines to someone's inventory. You could do something like this:

_magazines = 4
_count = 0

#forloop
? _count < _magazines : res_prisoner AddMagazine("AK74"); _count = _count + 1; goto "forloop"

In C++ this would have been:

for (int count = 0; count < magazines; ++count)
  res_prisoner.AddMagazine("AK74");

Although the script language does not look like the C/C++ language, it can do all the same basic operations, making it a very powerful tool.


thanks for all your help