The Dink Network

Savebot script

August 29th 2011, 01:22 AM
duckdie.gif
OK, this is really embarrassing, but I don't know how to make savebots. So, I searched the source folder in the develop folder for a savebot script but couldn't find one. So, how do I make a savebot?
August 29th 2011, 01:26 AM
wizardg.gif
Open dink in windinkedit+ find a savebot, find the name of the script. Copy the name, paste the name on your savebot, and Voila. That's one way to do it.
August 29th 2011, 01:27 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Take a savebot, give it all the hardness/repeat stuff, and then just name the script "savebot".

I think the savebot.c script is in the source folder somewhere. You just must have missed it.
August 29th 2011, 01:28 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
void main( void )
{
sp_seq(&current_sprite, 449);
sp_sound(&current_sprite, 34);
sp_brain(&current_sprite, 6);
sp_hitpoints(&current_sprite, 0);
}

void hit( void )
{
  say("Noisy humming thing Grr!", 1);
}

void talk( void )
{
Playsound(18,22050,0,0,0);

       freeze(1);
        choice_start();
        "Save your progress!"
        "Forget it, I messed up"
        choice_end();
         unfreeze(1);

        if (&result == 2)
        {
         unfreeze(1);
         say("Bye machine...", 1);
         return;
        }

        choice_start();
        "&savegameinfo"
        "&savegameinfo"
        "&savegameinfo"
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
         "Nevermind"
        choice_end();
        }

  unfreeze(1);

  if (&result < 11)
 {
  save_game(&result);
  say_xy("`%Game saved", 1, 30);
  }

}
August 29th 2011, 02:14 AM
boncag.gif
Godley
Peasant They/Them
 
void main( void )
{
loopmidi(1);
sp_seq(&current_sprite, 449);
sp_sound(&current_sprite, 34);
sp_brain(&current_sprite, 6);
sp_hitpoints(&current_sprite, 0);
}

void hit( void )
{
 say("Die, strange machine!", 1);
}

void talk( void )
{
Playsound(18,22050,0,0,0);

       freeze(1);
        choice_start();
        "Save your game"
        "Leave the strange machine"
        choice_end();
         unfreeze(1);

        if (&result == 2)
        {
         unfreeze(1);
         return;
        }
        choice_start();
        "&savegameinfo"
        "&savegameinfo"
        "&savegameinfo"
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
        "&savegameinfo" 
         "Nevermind"
        choice_end();

  unfreeze(1);

  if (&result < 11)
 {
  save_game(&result);
  say_xy("`%Game saved! Hooray!", 1, 30);
  }

}
August 29th 2011, 02:15 AM
duckdie.gif
Thanks for the script, MsDink. Yeah, WinRAR was being mean and only extracted half the source zip before breaking it up.
I'm trying to make a duck on a screen with a script attached to it, but I want it to go after you kill it. It keeps coming back after I leave the screen and come back. How can I fix this?
August 29th 2011, 02:15 AM
boncag.gif
Godley
Peasant They/Them
 
Take a sabebot, give it all the hardness/repeat stuff, and then just name the script "savebot".

I think the savebot.c script is in the source folder somewhere. You just must have missed it.


Skull, that is what was supossed to be there, but oddly enough, there is no saveebot.c in the develop folder.
August 29th 2011, 02:17 AM
boncag.gif
Godley
Peasant They/Them
 
Doodler, wouldnt "kill the script" work?
August 29th 2011, 02:19 AM
duckdie.gif
Kill_this_task?
I might try, yet I have a suspicion it works only like a local variable and once you come back the script is back up.
August 29th 2011, 02:31 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
DinkDoodler is right, it would indeed behave this way.

What you basically need to do is to make the duck 'conditionally active'. This means that you have some sort of global keeping track of what needs to happen and to make the duck active or not depending on the value of this global.

So in the script attached to the room you'd have a script like this:

void main(void)
{
if (&story == 6)
{
int &duck = create_sprite(400,200,3,21,1);
sp_script(&duck,"duck");
}
}

And then in duck.c:

void die(void)
{
&story = 7;
}

You could also use the editor_seq trick here, but when you're not making a large DMOD you'd probably not run into problems with limited globals anyway.
August 29th 2011, 02:35 AM
duckdie.gif
I would do that, but can you make a sprite out of scripts from the script of a sprite made from scripts? Very confusing, I know..... because I want a guy to come out and shout at Dink for killing his duck.
August 29th 2011, 02:39 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
yes - you would "spawn" a further script of the last one

So inside your duck one you could add something like

	if &story ==10 //or whatever number
	wait(500);
 
	spawn("nextduck");
August 29th 2011, 02:44 AM
duckdie.gif
Yes, but i think that a void hit(void) { followed by a create_sprite command could work too
August 29th 2011, 03:32 AM
duckdie.gif
Scripts working fine now, but now because I couldn't put it's properties in the editor I put them in scripts. The problem is:
It's not moving.
When I hit it it just stands there, with no head falling off, no blood.
It makes enough noise for a million ducks, not 1.
here are the two scripts. One is attached to a sack near the house where the guy to shout at Dink will appear, the other will be attached to the duck.
Sack script:
void main(void)
{
if(&duck == 0)
{
int &duck = create_sprite(289, 220, 3, 21, 1);
sp_script(&duck, "duck1");
}
if(&duck > 0)
{
return;
}


Duck script
void main(void)
{
sp_speed(&duck, 1);
sp_hitpoints(&duck, 10);
say("Finally, a duck to behead!", 1);
}
void hit(void)
{
//sneaky peek: using the pirate from joshriot's GRRRaphics, dialogue taken out though
int &pirate;
&pirate = create_sprite(443, 207, 0, 844, 7);
freeze(1);
say_stop("`4!", &pirate);
wait(100);
say("", 1);
wait(500);
say_stop("`4!", &pirate);
wait(50);
say_stop("`4bla", &pirate);
wait(50);
say_stop("`4bla!", &pirate);
wait(50);
say_stop("", 1);
wait(50);
&gold -= 50;
wait(1000);
say_stop("`4bla.", &pirate);
&gold += 50;
wait(50);
say_stop("`4bla", &pirate);
wait(50);
sp_kill(&pirate, 1);
say_stop("bla", 1);
&duck = 1;
unfreeze(1);
}
August 29th 2011, 04:34 AM
duckdie.gif
By the way, I have added &duck as a global variable in main.c so no problems there.
make_global_int("&duck", 0);
August 29th 2011, 04:55 AM
spike.gif
Try removing the "int" from
&duck = create_sprite(289, 220, 3, 21, 1);
If &duck is a global, it's unnecessary, and might even be screwing the poor animal.
August 29th 2011, 04:57 AM
duckdie.gif
lulz OK. I'll remove the int.
August 29th 2011, 05:03 AM
spike.gif
It should* work if you just remove the "int"... If you change it so that the &duck global is only used to advance the quest, remember to also change these lines in void main():

sp_speed(&duck, 1);
sp_hitpoints(&duck, 10);

->
sp_speed(&current_sprite, 1);
sp_hitpoints(&current_sprite, 10);


*it might or it might not work
August 29th 2011, 05:14 AM
duckdie.gif
Removed the int, it was OK with the duck, but after I'd kill it the guy wouldn't come. After some toiling around, I made it that if the whole duck dies he'll come, but that won't work because the sprite is dead. So I made it that another script will spawn when he beheads it and now it's working perfecto!
August 29th 2011, 07:06 AM
duckdie.gif
I've made a barrier that makes dink go back until he beheads the duck and talks to the guy, but while it works when he's supposed to talk to the guy, it doesn't work when he's supposed to behead the duck.
This script is attached to the fence that's gonna be the barrier. &duck is a global variable.
void main(void)
{
sp_touch_damage(&current_sprite, -1);
sp_nodraw(&current_sprite, 1);
}
void touch(void)
{
if(&duck == 0)
{
freeze(1);
move_stop(1, 8, 200, 1);
say("I wanna behead that duck!", 1);
unfreeze(1);
}
if(&duck == 1)
{
freeze(1);
move_stop(1, 8, 200, 1);
say("I should talk to that cranky pirate", 1);
unfreeze(1);
}
}

August 29th 2011, 07:26 AM
spike.gif
This comes back to using &duck for the duck... D'oh!

When you do the &duck = create_sprite(blah blah blah); thing, &duck's value changes from 0 to whatever (the new sprite's sprite number).

It's probably best to do what I think you meant to in the first place, ie. use a local variable to create the duck, instead of the &duck global.
August 29th 2011, 07:33 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
&quackBgone ??
August 29th 2011, 07:47 AM
duckdie.gif
Oh, thanks scratcher.
I'll change the global to &quackBgone like MsDink said so funny
August 29th 2011, 07:59 AM
duckdie.gif
Nope didn't work duck wouldn't come like before, tried this, nothing
void main(void)
{
sp_touch_damage(¤t_sprite, -1);
sp_nodraw(¤t_sprite, 1);
}
void touch(void)
{
if(&duck == create_sprite(289, 220, 3, 21, 1))
{
freeze(1);
move_stop(1, 8, 300, 1);
say("I wanna behead that duck!", 1);
unfreeze(1);
}
if(&duck == 1)
{
freeze(1);
move_stop(1, 8, 300, 1);
say("I should talk to that cranky pirate", 1);
unfreeze(1);
}
}
August 29th 2011, 08:21 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
Aww I dont think it will work with over 8 letters tho DD - sowwy DukbGon may work tho heh
August 29th 2011, 08:45 AM
duckdie.gif
used &quack. It works, kinda, but the duck doesn't die, doesn't have hitpoints or a basewalk.
void main(void)
{
sp_speed(&quack, 1);
sp_hitpoints(&quack, 10);
sp_base_walk(&quack, 20);
say("Finally, a duck to behead!", 1);
}
void die(void)
{
spawn("pirate");
}
August 29th 2011, 08:51 AM
duckdie.gif
added &quack as a global variable. (Dangit, do I have to do it for EVERY sprite to create!?)
Now it's working fine. Did a whole screen.... *yawn* me done D-modding fer the day....
August 29th 2011, 09:38 AM
spike.gif

//script where duck is created
&quack = create_sprite(289, 220, 3, 21, 1);
sp_script(&quack, "duck1");

//duck1.c script
void main(void)
{
sp_speed(&quack, 1);
sp_hitpoints(&quack, 10);
sp_base_walk(&quack, 20);


Something like this can't work unless &quack is a global... Local variables only work inside the same script where you create them. When the game switches to the duck1.c script, it has no idea who the duck &quack is supposed to be anymore. You need to use &current_sprite instead. Or you can do this:

//script where duck is created
int &quack = create_sprite(289, 220, 3, 21, 1);
sp_script(&quack, "duck1");

//duck1.c script
void main(void)
{
int &quack = &current_sprite;
sp_speed(&quack, 1);
sp_hitpoints(&quack, 10);
sp_base_walk(&quack, 20);
August 29th 2011, 09:42 AM
duckdie.gif
Thanks for the info, I've already made it a global but I'll this method next time.