Welcome, Guest. Please login or register.
Did you miss your activation email?

Username: Password:


Pages: [1]   Go Down

Author Topic: PDK behaviour rebuild  (Read 10756 times)

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
PDK behaviour rebuild
« on: August 30, 2009, 05:37:00 AM »

As i noted the behaviour examples under drive_example are scrambled thus making the behaviours; eat, whine and wag hard to read. Here is a behaviour template rebuilt and tested by yours truly.

// A behaviour template made by just bede//
// insert cmd and behaviour names where applicable//

#include <Log.inc>
#include <Animation.inc>

#include commands.inc

forward public init();
forward public main();
forward public close();


public init()
{
    print("Initializing insert_behaviour_name_here behaviour\n");
}

public main()
{

  for (;;)
  {
           command_exec(cmd_insert_cmd_name_here);
          
           while (command_is_playing(cmd_and_here))
           {
              sleep;
           }
  }

}

public close()
{
        print("Exiting insert_behaviour_name_here behavior\n");
}

Any problems give me a shout as for mistakes, oops hehe.

I would set up a download but i'm paranoid of my laptop not being clean.

The template should be saved under the behaviour name in the behaviour file of the drive_example.

Also i am now working on a drive rebuild for social and hunger. EDIT; this might take time it's really messed EDIT; if anyone can help with this one it would be most appreciated, parts from the start of the script are mixed in with the main chunk.
« Last Edit: August 30, 2009, 07:25:54 AM by justbede »
Logged


Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK behaviour rebuild
« Reply #1 on: August 30, 2009, 05:25:47 PM »

*needs to learn PAWN* :P Anyone know of a good guide?

Nice work though, great to see the PDK being used already :) Even I can see some exciting potential in there ;)
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK behaviour rebuild
« Reply #2 on: August 30, 2009, 10:15:39 PM »

Just give it a try it have a play with the examples and you'll start to see progress my only experience is with a language called ya_basic lol and thats old :p
Logged
Innvo Labs, creating life since 2009

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK behaviour rebuild
« Reply #3 on: August 31, 2009, 12:21:00 PM »

I have a basic build of the social.p script but i belive it may be missing a few lines of code or be slightly mixed up. As of this moment it works in Pleo and seems to perform as expected but i'll need confirmation. Heres the current script if anyone thinks they can tell if/where i may have miscoded, a full template will follow once i can confirm the validity of the code.

/////first working rebuild of social script, warning any mistakes may cause unwanted behaviour//
////// re-written by justbede
//////
/////
#include <Drive.inc>
#include <Property.inc>
#include <Log.inc>

#include "scripts.inc"

forward public social_init();
forward public social_eval();
forward public social_behavior_eval(behavior_id);
forward public social_exit();
forward public social_activate();
forward public social_deactivate();

social_init()//chngd
{

       behavior_add(scr_wag, "social", 0, 100, 100, 100, 1000);
       behavior_add(scr_whine, "social", 0, 100, 100, 100, 1000);


}




social_eval()

{


    printf("Life Statistics: blood_sugar is %d, happiness is %d\n", get(property_blood_sugar), get(property_happiness)); return 50;
   
    // By default, return a value of 50, so that
    // the social drive wins most of the time.

   


}





social_behavior_eval(behavior_id)
  // This function goes through each of the behaviors
                                         
// that are a part of this drive and selects one
// based on Pleo's happiness level.
//


{

 
             switch (behavior_id)

             {

   
                case scr_whine:

                    {

       
                  if
(property_get(property_happiness) < 40) 

             
        {
                             return 50;
                      }
                      return 100;
                    }
                    default:
                    {
                      return 0;
                    }
             }
}       
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK behaviour rebuild
« Reply #4 on: August 31, 2009, 05:19:51 PM »

Wish i could test it out, I am making some progress... I think :P Hopefully I'll catch up soon :)
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK behaviour rebuild
« Reply #5 on: September 01, 2009, 09:49:29 AM »

Heh i've been nerding, still experimenting with drives can't wait to see what people make
Logged
Innvo Labs, creating life since 2009

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK behaviour rebuild
« Reply #6 on: September 27, 2009, 12:45:17 PM »

Www terrible embarassment on my part but... the scripts open fine in microsoft word, wow! what a mess up on my part  :o sorry for any confusion caused as these rebuild are quite wrong  %) :-X

Update

On further investigation some scripts open in the correct order in Word but not notepad and others don't open correctly in either.
Sorry again for any confusion.
« Last Edit: September 28, 2009, 10:55:57 AM by justbede »
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK behaviour rebuild
« Reply #7 on: October 12, 2009, 04:09:31 PM »

I haven't had much chance to toy with the PDK lately but just curious, has anyone found out a solution to getting Pleo to perform a random action yet? Or will we be stuck using the leaky integers...
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK behaviour rebuild
« Reply #8 on: October 13, 2009, 10:47:17 AM »

I haven't had much chance to toy with the PDK lately but just curious, has anyone found out a solution to getting Pleo to perform a random action yet? Or will we be stuck using the leaky integers...

I'm pretty sure i read something in the docs but i'm pretty ill at the mo so i've stopped playing to :(
Logged
Innvo Labs, creating life since 2009

mischamd

  • Member of the herd
  • ** Posts: 19
  • Male
Re: PDK behaviour rebuild
« Reply #9 on: October 17, 2009, 10:46:28 AM »

i think to let pleo perform some random action you can use commands. if i understand the documentation right pleo choose random a action from it and you can and additional requirements like if pleo have found an object he has the additional choise to eat it XD
Logged

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK behaviour rebuild
« Reply #10 on: October 17, 2009, 11:29:04 AM »

I remember reading something in the api about generating a random number and then i believe you can use that to determine what action is performed.
Logged
Innvo Labs, creating life since 2009

DragonGirl

  • Outstanding in the herd
  • **** Posts: 63
Re: PDK behaviour rebuild
« Reply #11 on: October 21, 2009, 11:20:09 PM »

Is this what you are looking for?

The utility interface utility.ph defines the following on rand and seed functions.
(below copied from the api Pleo Reference Guide html pages manual)

rand returns a number between 0 and 1 which you can then modify to meet
your needs to map into activities (numbered set) in some range.
But I would need to test if actually is outputting that way - the doc isn't clear, but I can't imagine
it different if they don't mention it.
I expect it to act similarly to C/C++ and here seems a nice discussion on usage
which may help assist how to use seed.
http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx


-----------------------------------------------------------------
#include <String.inc>
#include <Time.inc>
#include "pleo/properties.inc"


Functions
native  rand (x)
  return a random number
 
native  seed (x)
  seed the random number generator
 

Details:
native rand  ( x    )   

return a random number


Parameters:
 range  of the random number to generate 

Returns:
random number

native seed  ( x    )   

seed the random number generator


Parameters:
 seed  value. typically use time() return as input 

Returns:
none
Logged

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK behaviour rebuild
« Reply #12 on: October 22, 2009, 01:30:58 AM »

Hmm interesting, hopefully in the near future I will get a chance to toy with it and see. Thank you :)
Logged
Eagerly awaiting Vector and Blue!
Pages: [1]   Go Up
 

SimplePortal 2.3.5 © 2008-2012, SimplePortal