Deprecations

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Deprecations

Post by Lestradae »

Quick question,

found out that "setStateMachine:" in AI's is deprecated in trunk.

So for the sake of future compatibility, how do I have to alter code like:

""NOTHING_FOUND" = ("setStateMachine: BlablaAI.plist");"

... so that it does stay valid in future Oolite?

I did read in the wiki about it before anyone asks, but did not find an answer conclusive enough for my tastes :oops:

Also something I don't understand how to alter is "Entity.setOrientation() is deprecated, use entity.orientation = foo instead."

Can someone give me an example of "before" and "after"?

Grateful for eventual explanation :D

L
User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 934
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Re: Deprecations

Post by Cmd. Cheyd »

Lestradae wrote:
Also something I don't understand how to alter is "Entity.setOrientation() is deprecated, use entity.orientation = foo instead."

Can someone give me an example of "before" and "after"?
I am by NO MEANS an authority, as I'm still working on my first OXP. But, I think the before would be:

Code: Select all

Entity.SetOrientation (w x y z);
The new/after method would be:

Code: Select all

entity.orientation = w x y z;
Is that what you're asking?
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

setStateMachine is obselete as you can directly set the state like this

ship.AIState ="BlablaAI.plist"

sry i meant

ship.AIState ="A_STATE_IN_THE_PLIST_FILE"

regarding orientation, it is the same deal

ship.orientation = ([1,0,0,0])

or

ship.orientation = (quaternion)

likewise for position and setPosition

ship.position = ([x,y,z])

or

ship.position =(vector)

remember the brackets[], when modifying the elements of the quaternions or vectors...

cheers Frame....
Bounty Scanner
Number 935
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

..

Post by Lestradae »

Thanks guys, very helpful, all clear now :D
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

This may be a dumb question (as I never new setStateMachine: existed before this thread), but how does setStateMachine: differ from setAITo: ?

Personally I would normally use setAITo: or switchAITo: to move from one AI to another, depending on whether it should be temporary or permanent.

Oh and ship.AIState= is a JS command not an AI one (you want setStateTo: to do that kind of switch within an AI).
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

regarding setStateMachine.. sorry I misread... I blame tireness.. early bird these days so early tired..

you are trying to start something from within the AI.plist..

you should send a scriptmessage instead.. but it is all in the wiki
or look at bouy repair, early versions, it used sendscriptmessage.

I never actually used setStateMachine, I think I tried, but gave up, and used setAIto or switchAI as thargoid wrote...
Bounty Scanner
Number 935
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Frame wrote:
you should send a scriptmessage instead..
No. It takes processingtime and should only be used if additional checks are necessary. For a simple replacement of 'setStateMachine' better use the AI methods.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Thargoid wrote:
This may be a dumb question (as I never new setStateMachine: existed before this thread), but how does setStateMachine: differ from setAITo: ?
It doesn't, they are identical. setStateMachine was never mend to be used in AI, although even 1.65 abusively still used it in some of its own AI's. Every case of setStateMachine can be replaced by setAITo.

But with the new white-listing we probably should link it to setAITo, so also old and wrong code will run?
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

...

Post by Lestradae »

So the safest method to re-precate (I hope Ahruman doesn't read that word) would be to exchange ...

Code: Select all

setStateMachine: BlablaAI.plist
... with ...

Code: Select all

setAITo: BlablaAI.plist
... correct?

8)

L
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: ...

Post by Eric Walch »

Lestradae wrote:

Code: Select all

setAITo: BlablaAI.plist
... correct?

8)

L
Yes.

Somehow that setStatemachine slipped into the Oolite escortAI. Only fixed around 1.70. It is the internal name of the machine that sets the AI states. setAITo calls the same internal function but was mend for public use.
But because it was in an old Oolite file and there are probably a lot escortAI modifications around, it is likely there are a lot oxp's around with this problem. On the whitelist we can relay these old names to legal ones. This way they will keep working.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

It's also in the wiki in a few places, via the same route.
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Re: ...

Post by Lestradae »

Eric Walch wrote:
On the whitelist we can relay these old names to legal ones. This way they will keep working.
That would be useful info for me if it was done - I have found quite a few setStatemachine switches in OSE's inherited AI's, I was about to change them all to, well, looks like setAITo, but if this stuff is whitelisted I can spare me that work.

Could you please tell me if and when a decision is taken on this? :)

8)

L
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: ...

Post by Eric Walch »

Lestradae wrote:
[Could you please tell me if and when a decision is taken on this? :)
L
I just added it as revision 2296 because it was long part of Oolites own AI set.
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

..

Post by Lestradae »

That was quick, very fine! You just spared me an afternoon of tedious copy&paste activity :D
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Are depreciations normally listed in the OXP verifier (-verify-oxp optional command line tags)? Just tried to verify a couple of OXPs that I know will need some update for the setPosition/setOrientation changes, and they didn't show.

Is it not something that's supported, or is it just because it's using a trunk compilation rather than a release test version?
Post Reply