Re: Touch Stuff
I have a room, with 18 pads, when Dink walks on one, it lights up, but all pads adjacent to it un-light (or whatever that word I'm looking for is). Below, I have my script so far, but instead of making all adjacent lights un-light, (there that word is again) I have just got Dink saying "Hello" for testing purposes. However, Dink doesn't say "Hello". What have I done wrong?
Here's my script:
// Script for pad which flashes lights when you step on it.
// Located in strange hut in Level 2 Caves.
void main ( void )
{
int &light1 = sp(21);
int &light2 = sp(22);
int &light3 = sp(23);
int &light4 = sp(24);
int &light5 = sp(25);
int &light6 = sp(26);
int &light7 = sp(27);
int &light8 = sp(28);
int &light9 = sp(29);
int &light10 = sp(30);
int &light11 = sp(31);
int &light12 = sp(32);
int &light13 = sp(33);
int &light14 = sp(34);
int &light15 = sp(35);
int &light16 = sp(36);
int &light17 = sp(37);
int &light18 = sp(38);
sp_touch_damage(¤t_sprite, -1);
}
void touch ( void )
{
sp_seq(¤t_sprite, 100);
sp_frame(¤t_sprite, 1);
sp_brain(¤t_sprite, 6);
if (¤t_sprite = &light1)
{
say_stop("Hello!", 1);
}
}
Here's my script:
// Script for pad which flashes lights when you step on it.
// Located in strange hut in Level 2 Caves.
void main ( void )
{
int &light1 = sp(21);
int &light2 = sp(22);
int &light3 = sp(23);
int &light4 = sp(24);
int &light5 = sp(25);
int &light6 = sp(26);
int &light7 = sp(27);
int &light8 = sp(28);
int &light9 = sp(29);
int &light10 = sp(30);
int &light11 = sp(31);
int &light12 = sp(32);
int &light13 = sp(33);
int &light14 = sp(34);
int &light15 = sp(35);
int &light16 = sp(36);
int &light17 = sp(37);
int &light18 = sp(38);
sp_touch_damage(¤t_sprite, -1);
}
void touch ( void )
{
sp_seq(¤t_sprite, 100);
sp_frame(¤t_sprite, 1);
sp_brain(¤t_sprite, 6);
if (¤t_sprite = &light1)
{
say_stop("Hello!", 1);
}
}
It sounds like the button brain would be ideal for this. (Otherwise you need to set touch damage to 0 when Dink steps on the pad or void touch will repeat over and over again, and again to -1 when Dink gets off)
//add in void main
sp_brain(¤t_sprite,14);
//replace void touch with
void buttonon()
{
sp_seq(¤t_sprite, 100);
sp_frame(¤t_sprite, 1);
sp_brain(¤t_sprite, 6);
if (¤t_sprite == &light1)
{
say_stop("Hello!", 1);
}
}
You were also missing one = in the if-check.
//add in void main
sp_brain(¤t_sprite,14);
//replace void touch with
void buttonon()
{
sp_seq(¤t_sprite, 100);
sp_frame(¤t_sprite, 1);
sp_brain(¤t_sprite, 6);
if (¤t_sprite == &light1)
{
say_stop("Hello!", 1);
}
}
You were also missing one = in the if-check.
That script requires 324 variables
Furthermore, sp is evil.
I suggest: extract sprite number from x,y.

Furthermore, sp is evil.
I suggest: extract sprite number from x,y.
Right, thanks for that, Scratcher.
And I think the = in the if check, may have been the problem.
Hehe.
And I think the = in the if check, may have been the problem.
