Author Topic: What's my plan! (critter view)  (Read 3176 times)

Offline adumbperson

  • Turn around in orbit!
What's my plan! (critter view)
« on: April 08, 2018, 11:59:53 am »
Hey readers,

https://bpaste.net/show/ba375d0be4f4
bpaste is no more a good place for lifetime expiry...

Code: [Select]
// AI debug helper
// by someone for someone who will enjoy it.
// License: do what the fuck you want with it.
// ____________________________________________
//
// HowToUse: (really? :/) "yeah! :D"
// ____________________________________________
//
// #include "_ai_debug_helper.fos"
//
// Log( npc.Id + " reason:" + plane_reason_str( reason ) + " plane:" + ai_type_str( plane.Type ) );
// ____________________________________________
//
// hint: Knowledges combination.
// ____________________________________________
//
// With care & love.

#ifndef __DEFINES__
#include "_defines.fos"
#endif

string@ ai_type_str( int ptype )
{
    switch(ptype)
    {
        case AI_PLANE_MISC:
            return "AI_PLANE_MISC";
        case AI_PLANE_ATTACK:
            return "AI_PLANE_ATTACK";
        case AI_PLANE_WALK:
            return "AI_PLANE_WALK";
        case AI_PLANE_PICK:
            return "AI_PLANE_PICK";
        case AI_PLANE_PATROL:
            return "AI_PLANE_PATROL";
        case AI_PLANE_COURIER:
            return "AI_PLANE_COURIER";
        default:
            break;
    }
    return "AI_UNSPEC";
}

string@ plane_reason_str( int preason )
{
    // Planes default priority
    switch(preason)
    {
        case REASON_GO_HOME:
            return "REASON_GO_HOME";
        case REASON_FOUND_IN_ENEMY_STACK:
            return "REASON_FOUND_IN_ENEMY_STACK";
        case REASON_FROM_DIALOG:
            return "REASON_FROM_DIALOG";
        case REASON_FROM_SCRIPT:
            return "REASON_FROM_SCRIPT";
        case REASON_RUN_AWAY:
            return "REASON_RUN_AWAY";
        case REASON_SUCCESS:
            return "REASON_SUCCESS";
        case REASON_HEX_TOO_FAR:
            return "REASON_HEX_TOO_FAR";
        case REASON_HEX_BUSY:
            return "REASON_HEX_BUSY";
        case REASON_HEX_BUSY_RING:
            return "REASON_HEX_BUSY_RING";
        case REASON_DEADLOCK:
            return "REASON_DEADLOCK";
        case REASON_TRACE_FAIL:
            return "REASON_TRACE_FAIL";
        case REASON_POSITION_NOT_FOUND:
            return "REASON_POSITION_NOT_FOUND";
        case REASON_FIND_PATH_ERROR:
            return "REASON_FIND_PATH_ERROR";
        case REASON_CANT_WALK:
            return "REASON_CANT_WALK";
        case REASON_TARGET_DISAPPEARED:
            return "REASON_TARGET_DISAPPEARED";
        case REASON_USE_ITEM_NOT_FOUND:
            return "REASON_USE_ITEM_NOT_FOUND";
        case REASON_GAG_CRITTER:
            return "REASON_GAG_CRITTER";
        case REASON_GAG_ITEM:
            return "REASON_GAG_ITEM";
        case REASON_NO_UNARMED:
            return "REASON_NO_UNARMED";
        case REASON_ATTACK_TARGET:
            return "REASON_ATTACK_TARGET";
        case REASON_ATTACK_WEAPON:
            return "REASON_ATTACK_WEAPON";
        case REASON_ATTACK_DISTANTION:
            return "REASON_ATTACK_DISTANTION";
        case REASON_ATTACK_USE_AIM:
            return "REASON_ATTACK_USE_AIM";
        default:
            break;
    }
    return "REASON_UNSPEC";
}


A lil script I had done to understand critter's plan...

May this be useful for ya.
« Last Edit: May 08, 2019, 02:56:30 am by adumbperson »
How did I end in delivery with that kind of log about me... my god... I no sure it were a good idea to read my log... ~suicide -2022/05/18-

Offline Wipe

  • Rotator
  • Random is god
Re: What's my plan! (critter view)
« Reply #1 on: April 08, 2018, 12:38:54 pm »
Why use string@ for pure log helper? string f(int) and return "UNKNOWN<"+pthing+">" as fallback, and you don't risk null exceptions in case of unknown values :)
Games are meant to be created, not played...

Offline adumbperson

  • Turn around in orbit!
Re: What's my plan! (critter view)
« Reply #2 on: April 13, 2019, 03:12:42 am »
Thanks for your reply, UB are real (not that I had missed it but you are right) ;D

Sorry for that late reply... had to flee an hell (in game) and I got bored from booting up my windows to dev my FOnline... :D

Now seems like I got enough desir to try making something. or not...

And no idea if I will play...

Time will tell.
How did I end in delivery with that kind of log about me... my god... I no sure it were a good idea to read my log... ~suicide -2022/05/18-