[Pogamut-list] mapping bot
Jakub Gemrot
jakub.gemrot at gmail.com
Sun Sep 14 12:29:01 CEST 2008
There must be a bug in your code somewhere else... anyway
here is the code that works ok for me :-)
Try it - if it fails then there is some problem with the PogamutCore
version or it's compilation
(but this should be for the version 1.1)
<code>
private NavPoint runTo = null;
protected void doLogic() {
log.warning("LOGIC ITERATION");
if (runTo == null) {
runTo = memory.getKnownNavPoints().get(random.nextInt(memory.getKnownNavPoints().size()));
log.info("Selected navpoint: " + runTo.UnrealID);
}
log.info("Searching path to: " + runTo.UnrealID);
switch (gameMap.pathManager.retrievePathGB(runTo.location)) {
case NO_PATH:
log.severe("Can't find path to navpoint: " + runTo.UnrealID);
runTo = null;
break;
case OBTAINING_PATH:
log.severe("Waiting for the path.");
break;
case PATH_FOUND:
log.info("Path found to: " + runTo.UnrealID);
switch(gameMap.pathManager.runAlongPath()) {
case PATH_BROKEN:
log.severe("PATH BROKEN");
runTo = null;
break;
case PATH_ENDED:
log.info("PATH ENDED");
runTo = null;
break;
case RUNNING_ALONG:
log.info("Continuing the movement to: " + runTo.UnrealID);
break;
}
}
}
</code>
Good luck!
Jakub
On Sat, Sep 13, 2008 at 1:32 AM, cazub
<pogamut-forum at artemis.ms.mff.cuni.cz> wrote:
> Re: Re: Re: Re: mapping bot
>> ok jakub i'm stuck :( , i don't think i understand how to check for PATH_FOUND
>>
>> String pathFound = "";
>> pathFound = gameMap.pathManager.retrievePathGB(this.choosenNavPoint.location).toString();
>> if(pathFound.equals("PATH_FOUND")){
>> this.gameMap.pathManager.runAlongPath();
>> }
>>
>> is what i'm doing and that doesn't seem to be working, how do i do this exactly??
>
> Ok i'm noticing that if i put
> gameMap.pathManager.retrievePathGB()
> anywhere in my doLogic loop my bot is extremley unresponsive, never seems to find a path and if i have something like
>
> this.body.sendGlobalMessage("String printing before retrieveGB");
> gameMap.pathManager.retrievePathGB()
> this.body.sendGlobalMessage("String printing after retrieveGB");
>
> basically neither of those messages will get posted, even if i bury the retrievePathGB into an if() statement and thsoe messages are not affected by retrieveGB in any logical way......... they STILL won't be posted. I had to get rid of that retrieve function entirley to get any sort of logic to function for my bot. Needless to say a bot that doesn't move isn't of much use :( Any ideas? , still not sure how to check for "PATH_FOUND" either
>
> ----
>
> Reply Link: <https://artemis.ms.mff.cuni.cz/pogamut/tiki-view_forum_thread.php?forumId=6&comments_reply_threadId=238&comments_parentId=222&post_reply=1#form>
>
>
> _______________________________________________
> Pogamut-list mailing list
> Pogamut-list at artemis.ms.mff.cuni.cz
> https://artemis.ms.mff.cuni.cz/mailman/listinfo/pogamut-list
>
More information about the Pogamut-list
mailing list