Old functions 2.x vs new functions 3.x in script

Started by GoodGuy, Sun 29/01/2017 06:08:20

Previous topic - Next topic

GoodGuy

Hi, guys. I know that AGS 3.4 has more advantages than AGS 2.x. I apologize for the stupid question. I use AGS 3.4 (2.7) and it supports the old functions from AGS 2.x, if I disabled "Enforce..." in General Setting - Backwards Compatability. Are Old and new functions very different from each other? For example NewRoomEx(2,10,10) and cEgo.ChangeRoom(2,10,10).

GoodGuy

I found in FAQ about new script language:
Quotethe script is more intuitive for people to learn, much easier to read (no guessing what all the numbers mean in the AnimateObjectEx call), and therefore you're less likely to make mistakes when using it.

Danvzare

#2
The new functions usually do the exact same stuff as the old functions. They were changed to migrate the engine to a more object orientated language. Which is generally considered easier to code, read, and generally work with.

I'd highly recommend you stick with the new functions, because the old functions were only left in there for people who import their projects in from an older version, as far as I know.

GoodGuy

There are example of new script language from FAQ. New language are better than old one.
QuoteFirstly, so that you can get an idea of the changes, here's an example of some old-style script commands and their new equivalents:

AnimateObjectEx(0,2,0,0,0,1);
ListBoxAdd(3, 5, "New item");

becomes:
oWaterfall.Animate(2, 0, eOnce, eForwards, eBlock);
lstTest.AddItem("New item");

Just from looking at that example the advantages should be obvious; the script is more intuitive for people to learn, much easier to read (no guessing what all the numbers mean in the AnimateObjectEx call), and therefore you're less likely to make mistakes when using it. GUI controls having names brings it much more into line with Visual Basic-style GUI development, so you don't have to remember what control number all your buttons are.

SMF spam blocked by CleanTalk