Deprecations
Moderators: winston, another_commander, Getafix
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Deprecations
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
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
L
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
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
L
- Cmd. Cheyd
- ---- 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
I am by NO MEANS an authority, as I'm still working on my first OXP. But, I think the before would be: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"?
Code: Select all
Entity.SetOrientation (w x y z);
Code: Select all
entity.orientation = w x y z;
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....
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
Number 935
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).
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).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
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...
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
Number 935
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
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.Thargoid wrote:This may be a dumb question (as I never new setStateMachine: existed before this thread), but how does setStateMachine: differ from setAITo: ?
But with the new white-listing we probably should link it to setAITo, so also old and wrong code will run?
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
...
So the safest method to re-precate (I hope Ahruman doesn't read that word) would be to exchange ...
... with ...
... correct?
L
Code: Select all
setStateMachine: BlablaAI.plist
Code: Select all
setAITo: BlablaAI.plist
L
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: ...
Yes.Lestradae wrote:
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.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
It's also in the wiki in a few places, via the same route.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Re: ...
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.Eric Walch wrote:On the whitelist we can relay these old names to legal ones. This way they will keep working.
Could you please tell me if and when a decision is taken on this?
L
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: ...
I just added it as revision 2296 because it was long part of Oolites own AI set.Lestradae wrote:[Could you please tell me if and when a decision is taken on this?
L
UPS-Courier & DeepSpacePirates & others at the box and some older versions
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?
Is it not something that's supported, or is it just because it's using a trunk compilation rather than a release test version?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link