Full Version : Think or OnThink That is the question
xmlspawner >>Scripting Support >>Think or OnThink That is the question


<< Prev | Next >>

koluch- 09-22-2006
Quick question ( Hope you dont mind Arte )
This is hard one to track down

Looking through scripts I see most of the time it is "OnThink" but in some scripts people release and such I also see a "Think"
Is there a differance between the 2 ?
Reason I ask is once in awhile I get a crash and on the log it says " Think " not a "Onthink so am I heading in the right direction on my Think and OnThink...
Hehee a whole bunch of thinking going on.

This is the error

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Map.PooledEnumerable.Free()
at Server.Map.ObjectEnumerator.Free()
at Server.Map.ObjectEnumerator.Dispose()
at Server.Mobile.Move(Direction d)
at Server.Mobiles.BaseAI.DoMoveImpl(Direction d)
at Server.Mobiles.BaseAI.DoMove(Direction d, Boolean badStateOk)
at Server.Mobiles.BaseAI.DoMove(Direction d)
at Server.Mobiles.BaseAI.WalkRandom(Int32 iChanceToNotMove, Int32 iChanceToDir, Int32 iSteps)
at Server.Mobiles.BaseAI.WalkRandomInHome(Int32 iChanceToNotMove, Int32 iChanceToDir, Int32 iSteps)
at Server.Mobiles.BaseAI.DoActionWander()
at Server.Mobiles.AnimalAI.DoActionWander()
at Server.Mobiles.BaseAI.Think()
at Server.Mobiles.BaseAI.AITimer.OnTick()
at Server.Timer.Slice()
at Server.Core.Main(String[] args)

In the Mirror image there is a " Think " not a " Onthink " also few other scripts.

Thanks in advance for any idea's

Allmight- 09-22-2006
Well, without looking in the scripts my guess would be that the Think() method forces the AI to perform the think procedure, while the OnThink() is called when the AI is in the think procedure. I am not 100% sure, but if they follow the standard naming convention, this is what is should mean.