Bob the Pleo Forums

Pleo Stuff => Pleo Hardware/Software => PDK, Programming, and code => Topic started by: Dinomour on June 04, 2019, 04:28:48 AM

Title: Becoming familiar with PrbDK
Post by: Dinomour on June 04, 2019, 04:28:48 AM
Hi,

I'm very sorry if my question sounds trivial.

I am trying to familiarize myself with PrbDK. So I began with very easy things...

My script is:

Code: [Select]
//
// Very simple sensors.p example. Add code to on_sensor for those
// sensors you would like to respond to.
//
 
// save space by packing all strings
#pragma pack 1

#include <Log.inc>
#include <Script.inc>
#include <Sensor.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)
    {
case SENSOR_HEAD:
sound_play(snd_growl);
    }
   
// reset sensor trigger
    return true;
}


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

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

But when I try to build my application, I get:

Code: [Select]
PS C:\Program Files (x86)\PrbDK\examples\sensor_test> ../../bin/upf_project_tool.exe sensors.upf rebuild
C:\Program Files (x86)\PrbDK\bin\upf_project_tool.exe:20: DeprecationWarning: the sets module is deprecated
  $ð¸┬   tâ

*** Cleaning ***
  Removing include/sounds.inc
  Removing sounds.xml
  Removing include/motions.inc
  Removing motions.xml
  Removing include/scripts.inc
  Removing scripts.xml
  Complete Clean: Removing build directory 'build'

*** Prepocessing ***
  Updating enumeration XML 'sounds.xml'
  Creating enumeration 'include/sounds.inc'
  Updating enumeration XML 'motions.xml'
  Creating enumeration 'include/motions.inc'
  Updating enumeration XML 'commands.xml'
  no data for commands
  Updating enumeration XML 'scripts.xml'
  Creating enumeration 'include/scripts.inc'
  Updating enumeration XML 'user_properties.xml'
  no data for user_properties

*** Processing ***
  Converting ../../media/sounds/growl.wav to build/4096.usf adpcm:0 pitch:1 freq:11025
  Converting ../../media/motions/bow.csv to build/8192.umf, UMF3 format
done writing umf3 file; average vector length=15, count=98; frames=102
  @ ..\..\bin\pawncc33 ./sensors.p -O2 -V8192 -v2 -S128 -C-  -iinclude -i..\..\include -obuild/16384.amx
Pawn compiler 3.3.3930                  Copyright (c) 1997-2008, ITB CompuPhase

./sensors.p(31) : error 017: undefined symbol "sound_play"

1 Error.
  ERROR: building script './sensors.p'

Does anyone knows why I get this error?

Thank you in advance for your help!  :)


EDIT : I could solve it. I took "touch_test" and I modified it with a home-made sound. It worked. Now, I'm trying to think about motion with embedded sound  ;)
Title: Re: Becoming familiar with PrbDK
Post by: pnhicks on June 04, 2019, 08:27:21 AM
Hi Dinomour,


It would appear from your code that you didn't add the lines 12 and 13
#include <Sounds.inc>
#include "sounds.inc"


That should fix you up!


Cheers,


Peter

SimplePortal 2.3.5 © 2008-2012, SimplePortal