Gps Question(SOLVED)
I have a a path for mining. There are 70 points total with a "Start" and "End" point. The Start and end do not connect, so it is just a straight path.
When I reach the end, I want it to go back to the start.
In my movement class, I have this code:
Which it will basically start off by running to the start point first. Then in my preGpsMove code I do:
Which basically says: If I am at my start point, go to the end, if i am at the end point go to the start. It does not do this and just crashes my updater.
Any insight please :/
EDIT:
Figured it out
and
I have a a path for mining. There are 70 points total with a "Start" and "End" point. The Start and end do not connect, so it is just a straight path.
When I reach the end, I want it to go back to the start.
In my movement class, I have this code:
PHP:
private void MovementThread()
{
this.gps = new Gps(core);
this.gps.LoadDataBase(gpsFile);
this.gps.onGpsPreMove += gpsPreMove;
this.gps.onGpsPostMove += gpsPostMove;
while (!this.gps.GpsMove("Start", 10)) ;
while (true)
{
if (useGpsPositions)
{
core.Log("Doing start of route");
if ((Doodads.engagingDoodad && Doodads.CollectDoodads) || core.me.inFight)
this.gps.SuspendGpsMove();
else
this.gps.ResumeGpsMove();
Thread.Sleep(PluginClass.timerDelay);
}
}
}
Which it will basically start off by running to the start point first. Then in my preGpsMove code I do:
PHP:
GpsPoint finishPoint = this.gps.GetPoint("End");
if (point == finishPoint)
{
this.gps.GpsMove("Start", 5);
}
GpsPoint startPoint = this.gps.GetPoint("Start");
if (point == startPoint)
{
this.gps.GpsMove("End", 5)
}
Which basically says: If I am at my start point, go to the end, if i am at the end point go to the start. It does not do this and just crashes my updater.
Any insight please :/
EDIT:
Figured it out
PHP:
private void gpsPreMove(GpsPoint point)
{
while ((Doodads.engagingDoodad && Doodads.CollectDoodads) || core.me.inFight)
{
Thread.Sleep(PluginClass.timerDelay);
}
}
and
PHP:
private void MovementThread()
{
this.gps = new Gps(core);
this.gps.LoadDataBase(gpsFile);
this.gps.onGpsPreMove += gpsPreMove;
this.gps.onGpsPostMove += gpsPostMove;
while (true)
{
if (useGpsPositions)
{
core.Log("Doing start of route");
while (!this.gps.GpsMove("Start")) ;
Thread.Sleep(PluginClass.timerDelay);
while (!this.gps.GpsMove("End")) ;
Thread.Sleep(PluginClass.timerDelay);
}
}
}
Last edited: