The Dink Network

Touch Stuff

April 8th 2008, 05:12 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
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(&current_sprite, -1);
}

void touch ( void )
{
sp_seq(&current_sprite, 100);
sp_frame(&current_sprite, 1);
sp_brain(&current_sprite, 6);

if (&current_sprite = &light1)
{
say_stop("Hello!", 1);
}
}
April 8th 2008, 05:34 AM
spike.gif
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(&current_sprite,14);

//replace void touch with
void buttonon()
{
sp_seq(&current_sprite, 100);
sp_frame(&current_sprite, 1);
sp_brain(&current_sprite, 6);
if (&current_sprite == &light1)
{
say_stop("Hello!", 1);
}
}

You were also missing one = in the if-check.
April 8th 2008, 06:38 AM
fairy.gif
Someone
Peasant He/Him Australia
 
That script requires 324 variables

Furthermore, sp is evil.

I suggest: extract sprite number from x,y.
April 8th 2008, 05:29 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Right, thanks for that, Scratcher.

And I think the = in the if check, may have been the problem. Hehe.