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

Username: Password:


Pages: [1]   Go Down

Author Topic: NEED HELP!!! Could someone help me check this rehatch serum code.  (Read 3218 times)

zetathix

  • Head of the herd
  • **** Posts: 70
  • Male

Could anyone please check with this script that is fine to use?

It's just a simple script.


MAIN.P

Code: [Select]
//
// Rehatching script. *** USE WITH CAUTION. IT MAY CAUSE YOUR PLEO MALFUNCTION!!!***
//
 
// save space by packing all strings
#pragma pack 1

#include <Log.inc>
#include <property.inc>
#include <Script.inc>
#include <Sound.inc>

//#include "ages.inc"
#include "user_properties.inc"
#include "sounds.inc"

public init()
{
    print("main::init() enter\n");

    print("main::init() exit\n");
}

public main()
{
    print("main::main() enter\n");

    for (;;)
    {
        // give some time back to the firmware
while (property_get(property_age) > 2)
{
// Sounds are referred to by their filename,
            // minus the extension, with a prefix of "snd_".
            sound_play(snd_moo);

if (property_get(property_front_left_tapped))
{
// Reset the head tapped property, to indicate
// that we've taken action.
property_set(property_front_left_tapped, 0);

// Set age to hatch stage.
// NOW I'M STILL NOT SURE 1 OR 2 IS THE HATCHLING STAGE.
// AS IN INCLUDE IT SAY BIRTHING AND HATCHLING.
property_set(property_age = age_hatchling) // 2
}
}
// give some time back to the firmware
        yield();
    }

    // left in, this generates an 'unreachable code' Pawn warning
    //print("main::main() exit\n");
}

public close()
{
    print("main:close() enter\n");

    print("main:close() exit\n");
}


SENSORS.P

Code: [Select]
//
// sensors.p
// Properties Example
//
// This sensors.p script runs in the Sensors VM. It
// watches sensors and sets properties to notify the
// other scripts of certain events.
//
// The sensors used in this example are derived sensors
// and they may require that you use special methods to
// modify them. See the PDK documentation for more details.
//
 
// save space by packing all strings
#pragma pack 1

#include <Log.inc>
#include <Script.inc>
#include <Sensor.inc>
#include <Property.inc>

#include "user_properties.inc"

public init()
{
    print("sensors:init() enter\n");
   
    print("sensors:init() exit\n");
}

public on_sensor(time, sensor_name: sensor, value)
{
    new name[32];
    sensor_get_name(sensor, name);
   
    printf("sensors:on_sensor(%d, %s, %d)\n", time, name, value);
   
    switch (sensor)
    {
        // SENSOR_TOUCH_TAP tells us that a sensor
        // has been tapped - the value passed by SENSOR_TOUCH_TAP
        // is equal to the sensor that is being held.
        case SENSOR_TOUCH_TAP:
        {
            if (sensor_name:value == SENSOR_FRONT_LEFT)
            {
                // Let other scripts know that the front left foot
                // sensor has been tapped.
                property_set(property_front_left_tapped, 1);
            }
        }
   
    }
   
    // reset sensor trigger
    return true;
}

public close()
{
    print("sensors:close() enter\n");

    print("sensors:close() exit\n");
}


REHATCH.UPF

Code: [Select]
<upf_project name="rehatch">

  <options>
    <set name="top" value="../.." />
    <include value="./include:${top}/include" />
    <tools>
     <pawn value="../../bin/pawncc33 %i -O2 -V8192 -v2 -S128 -C- %I -o%o" />
    </tools>
    <directories>
      <build value="build" />
      <include value="include" />
    </directories>
    <umf value="3" />
    <folders />
  </options>

  <set-default name="MEDIA" value="../../media" />

  <set name="SOUNDS" value="${MEDIA}/sounds" />
  <set name="MOTIONS" value="${MEDIA}/motions" />
  <set name="COMMANDS" value="${MEDIA}/commands" />
  <set name="SCRIPTS" value="${MEDIA}/scripts" />

  <resources>

    <!-- Sounds -->
    <sound path="${SOUNDS}/moo.wav" />

    <!-- Motions -->

    <!-- User Properties -->
    <user_property path="front_left_tapped" />

    <!-- Scripts -->
    <script path="main.p" />
    <script path="sensors.p" />

  </resources>
</upf_project>


description :
When script run, it will check for current age stage. If it older than hatchling stage, Pleo will continuous moo. And if you press front left foot (of Pleo), it will re-aging back to hatchling stage.

todo :
add cancel button

PROBLEM :
In doc, it says no use for PROPERTY_AGE, so it must be relate with \pleo\age.inc. But now I'm still find out what's age variable. And other thing is I don't know which parameters need to pull down to hatchling level, which numbers need to put in.

As I read in Aibohack.com, this task can do with ChangeRB. But no any source. So I must keep figure it out.
Logged


Crewella

  • Moderator
  • Pleo Grand Master RB
  • **** Posts: 5671
  • gb Female
  • Pleo(s): Iggy, Budge, Moschops, Monty, Emmy. Belle, Zillah, Tribble
  • : 2010 winnerTomat Harvest Festivals
    • Ginger
    • Pepe_Le_Pew
    • Animal
    • Flying_Ace
Re: NEED HELP!!! Could someone help me check this rehatch serum code.
« Reply #1 on: February 18, 2013, 11:45:36 AM »

Wish I could help, but someone like PleoPet would be your best bet.  :)
Logged

degers

  • Administrator
  • Pleo adept
  • * Posts: 722
  • gb Male
  • Degers can't be choosers
Re: NEED HELP!!! Could someone help me check this rehatch serum code.
« Reply #2 on: February 18, 2013, 11:53:52 AM »

Can you not make an automon.txt?

Rm pm_props
Rm pm_drives

Logged

zetathix

  • Head of the herd
  • **** Posts: 70
  • Male
Re: NEED HELP!!! Could someone help me check this rehatch serum code.
« Reply #3 on: February 18, 2013, 01:46:58 PM »

@degers I'm so sorry, could you please specify what is you write? I'm not familiar with automon.txt.  :-[
Logged

mweed

  • Grand Poobah
  • Triassic pleo master
  • ***** Posts: 1758
  • us Male
  • Pleo(s): Bob, Mopey
  • : Tomat Harvest Festivals
    • Professor
    • Wile_E_Coyote
    • Dr_Bunsen_Honeydew
    • Snoopy
    • Bob the Pleo
Re: NEED HELP!!! Could someone help me check this rehatch serum code.
« Reply #4 on: February 18, 2013, 03:47:58 PM »

automon.txt is a plain ASCII text file that the pleo executes at startup . . . kind of like a DOS .BAT file or a unix/linux command script.

I've used then to create backups, etc.   Deger's script simply deletes the files that store the pleo's personality.  On a Ugobe pleo, this does pretty much reset it.  On an RB, I'm not sure.

And, although the concept is right, I'm pretty sure the script won't run as is, degers, you'll want to add a few additional lines to the file.  This is the file as derived from aibohack/pleopet's original reset for the Ugobe:

Code: [Select]
access 3
copy b:pm_props a:pm_props.bak
copy b:pm_drives a:pm_drives.bak
rm b:pm_props
rm b:pm_drives

The two copy commands make a back-up of the files to the SD card, in case you need/want to restore them.  (Always a wise move.)  And I might suggest someone copying the files off of a unhatched/newborn RB and then rather than deleing the files, maybe try replacing the existing files with the ones from the newborn RB.  If all goes well, you could even custom tailor the files so you can select the sex and personality traits you want.
« Last Edit: February 18, 2013, 03:52:11 PM by mweed »
Logged

zetathix

  • Head of the herd
  • **** Posts: 70
  • Male
Re: NEED HELP!!! Could someone help me check this rehatch serum code.
« Reply #5 on: February 18, 2013, 11:36:03 PM »

Ok, now I have found a doc one on the old PDK. PLEO MONITOR, right?

Now it's looks familiar for me, some like DOS. I will read all in this doc first and maybe it have a clue for my doubt.

I will specify to looking into cmd which you said.
Logged

zetathix

  • Head of the herd
  • **** Posts: 70
  • Male
Re: NEED HELP!!! Could someone help me check this rehatch serum code.
« Reply #6 on: February 19, 2013, 04:49:22 AM »

So I need automon.txt to pull out props names and save it back to some file for pm_ list.

I also try to add something that draw all resources and info to back it up. Could this will work?

Code: [Select]
access 3
log enable
log eol dos
property show
resource backup a:/_pm.bak
ls b:
copy b:/pm_props a:/pm_props.bak
copy b:/pm_drives a:/pm_drives.bak
rm b:/pm_props
rm b:/pm_drives
time
log file a:/1.log flush
log file off
power off

This automon will ...

1. pull prop names out.
2. back up resources (which I think this is pleopm).
3. list files on B:
4. back up pm_props and pm_drives.
5. rem both original files.
6. stamp process time to log.
7. save to a log called "1.log".
8. close log file.
9. shut the Pleo down.

No risk command, maybe safe enough. Any suggestion?
« Last Edit: February 19, 2013, 08:09:39 AM by zetathix »
Logged
Pages: [1]   Go Up
 

SimplePortal 2.3.5 © 2008-2012, SimplePortal