Prowler Productions
  Dink Smallwood Forum
  Questions from a beginner

Post New Topic  
profile | register | faq

Author Topic:   Questions from a beginner
Sven2000 posted 02-14- 06:49 AM CT (US)   Click Here to See the Profile for Sven2000   Click Here to Email Sven2000  
I need help with vissions, i read some help file about dink which tol me the following:

Visions are VERY useful. Suppose you have an NPC (like the guy hiding behind the wall in Elemental Peace) that you only want to appear if a certain condition is true. Change vision to 1 (it defaults to 0) and add your NPC. Now, change the vision back to 0 and the NPC appears to have vanished! Change back to 1, and he's there. Note that it's best to use visions of 1 and 2 and 3 so you'll remember where your hidden sprites are later.

You can also move existing sprites into a vision. Simply “pick up” the sprite in vision 0, press “V” and change to a different vision, press to drop the sprite in this new vision, then change the vision back to 0.

To make visions work with the game, simply attach a script (press “B”) to the room. In the “main” function of this room script, change the vision! In Elemental Peace I used one script for all rooms to make it much simpler, then I just check to see what room the player is in, and if a certain thing has been done:


void main(void)
{
//default to vision 0 for everything....
//Note that it isn't necessary to set vision to 0 at the beginning of
//a room, because vision is reset to 0 every time Dink walks or warps
//to a new room... but I set it to 0 anyway just because I want to.
&vision = 0;
//check to see if the player is in room #402...
if (&player_map == 402)
{
//Yes they are, so now check to see if they have talked to BOB
if (&talkbob > 0)
{
//change to vision 1 now
&vision = 1;
}
}
//check to see if the player is in room #530...
if (&player_map == 530)
{
//Yes, so check to see if they've killed the goblin yet...
if (&killed_gob == 0)
{
//They haven't killed the goblin yet, so let's change vision
//to 1 so that the blocker still shows up in this room.
&vision = 1;
}
}
}

I dont understand how visions work anyway, so i wonder if someone can tell me how to use them or the URL of a tutorial containing inof about visions.

Beuc posted 02-14- 02:14 PM CT (US)     Click Here to See the Profile for Beuc  Click Here to Email Beuc     
Ok, let's try.
When you work on a DMOD, when you place sprites, then Dink can always see them.
You place sprites for that, don't you? ;)
It is vision 0. If a sprite is in vision 0, then he always can be seen.

Now, by pressing 'V' in DinkEdit, you change the vision. Let's say you set a vision of 2.
Then all sprite from vision 0 are visible, because they're always present, no matter the vision.
If now you place sprite, these sprites are now in vision 2.
If you press 'V' and then set vision back to 0, these new sprites will disappear.
They can only be seen in vision 2.


Now, when you PLAY Dink, to test your DMOD, if you didn't script anything, you'll see all sprites from vision 0, as always, and not any of the sprites you placed with vision = 2.

So How to see the sprites you placed in vision 2?
You must write a script, attached to screen (using the 'B' key in DinkEdit), where you say &vision = 2.
Now that &vision = 2, you can see all sprites from vision 0, which are always visible, and also sprite placed with vision 1 in DinkEdit.

This script must consider if Dink has done something special before to set vision 2.
e.g., let's say that you placed a scroll with vision 2, and that you want Dink to see it ONLY if he has MORE than 10 magic points, here the script you'll attach to the screen with countains the bridge:

void main(void)
{
  if &magic > 10
  {
    &vision = 2
  }
}

If Dink has less than 10, or 10, magic points, then &vision is NOT set to 2, and so the scroll isn't displayed.
If Dink has more than 10 magic points, then the magic scroll will be displayed, and so Dink will be able to pick up and kill enemie with it ;)

Now, if Dink quits screen, &vision is again set to 0, automatically.
So if you go to a screen where vision is set to 2 only if Dink has more than 10 strength, and if he don't have more than 10 strength, then he won't be able to see the sprites with vision 2.

Also, if Dink has a vision of 2, he can see sprites from vision 0, but not sprites from vision 3 and NOT sprites from vision 1.


I hope this will make you able to now read Mike's text on visions :)
I you have any other question, then post to this topic.

All the best!

Sven2000 posted 02-17- 06:33 AM CT (US)     Click Here to See the Profile for Sven2000  Click Here to Email Sven2000     
Hi again, i got another question:
I have a room whith some sprites in, and i want dink to not be able to walk to an other screen until he have spoken to one of the peaple in that screen, so i use the following script for the room:

void main(void)
{
void screenlock(1);
if (&Int1 == 1)
{
void screenlock(0);
}
}

and the following code for the sprite he has to speak to:

Void talk(void)
{
Freeze(1)
say("`3You should go to our house and check it out, its in the South-West from here.", ¤t_sprite);
make_global_int( char int1[20], int 1);
Freeze(0)
}

and it doesnt work, should i create the integer and use a script to make it +1 or should it work to do it this way? If i have to make the integer first and then add 1 i would like to know how.

Beuc posted 02-18- 08:29 AM CT (US)     Click Here to See the Profile for Beuc  Click Here to Email Beuc     
There're lots of small errors in your scripts:

- when you want to use a procedure, you don't have to use type "void" before.
So type
  screenlock(1);

- to freeze a sprite, use freeze(sprite#).
As Dink is sprite #1, to freeze Dink use
  freeze(1);
And to unfreeze him, type:
  unfreeze(1);
The same way, if you want to freeze the script which script is currently running (e.g. the sprite to which you attached your script), then type
  freeze(&current_sprite);

- to make a goblal int, put the line in the main.c file.
The syntax isn't
make_global_int( char int1[20], int 1);
char int1[20], in the help file, just mean you have to type some letters, a max of 20, to identify your variable.

Use (in Main.c):
make_global_int("&var", initial value);
I'm not sure you can use Caps in variable.

And when you want to change the variable, just type
&var = 2;

Be aware: you have a max of 50 make_global_int().


- last error, the most important, void main(void) is read only one time by DinkC. So you will enter the house where there's your guy, then DinkC will execute the script; as you didn't speak to him yet, he will lock the screen. Then, you'll talk to him, and DinkC will execute the talk(void) part, but nothing else!
So the screen will stay locked...
So or you unlock the screen in the talk(void) part, or you use the goto command to go again to main.

Here what could be the script:
[in Main.c]
make_global_int("&spoken", 0);


[in you guy's script]
void main(void)
{
  loop:
  if (&spoken == 1)
  {
    screenlock(0);
  } else
  {
    screenlock(1);
  }
}

void talk(void)
{
  freeze(1)
  say("`3You should go to our house and check it out, its in the South-West from here.", &current_sprite);
  spoken = 1;
  unfreeze(1);
  goto loop;
}


Make sure to understand all. And be aware, in DinkC.txt, procedures are presented using "notes" which you don't put in your scripts, as "void", or "char[20]".
Try to study existing codes, as Dink's or Mistery Island's scripts.

Beuc posted 02-18- 08:31 AM CT (US)     Click Here to See the Profile for Beuc  Click Here to Email Beuc     
he, in the lasts line, I forgot the &, so you have to type:
&spoken = 1;
Sven2000 posted 02-18- 08:50 AM CT (US)     Click Here to See the Profile for Sven2000  Click Here to Email Sven2000     
Thanks for the help
Sven2000 posted 02-18- 02:11 PM CT (US)     Click Here to See the Profile for Sven2000  Click Here to Email Sven2000     
Hi again, i tried to add an item but it wont work, i found this in the dinc file:
int add_item(char scriptname[8], int seq, int frame);
so i thought my script should look like:
int add_item(char Item-Axe[6], int seq, int frame);
becuase the script name for the weapon is Item-axe and the picture of it is number six, what am i doing wrong?
Beuc posted 02-19- 11:52 AM CT (US)     Click Here to See the Profile for Beuc  Click Here to Email Beuc     
The help file show you the types of the variables:
char[20] just mean "a word between " and " and which is 20 char long maximum".

So
int add_item(char scriptname[8], int seq, int frame);
means:

- char scriptname[8]: a script name which is 8 char long, as "Item-Axe";

- int seq: an integer, which is the sequence for the item picture, so for example 70;

- int frame: and an integer (number not decimal), which is the number of the item picture inside the sequence.

- int add_item: means that the procedure's value is an integer. It's usefull when you create a sprite, with
create_sprite (I think).
You type &paul = create_sprite(...), and then &paul is the number of the sprite you created. Ok?

So, for example

add_item("Item-Axe", 70, 2);
(70 and 2 are purely invented numbers).

To find the seq and the frame number, you have to type 'E' in sprite mode in DinkEdit, and then see the numbers in the bottom of the screen when you select a square: this number is the seq. Then, the squares you know see (after having selected a first square), are all the frame of the seq. The first square has #1, the second #2, etc, and so you find the frame number.

All the best!

Sven2000 posted 02-25- 02:00 AM CT (US)     Click Here to See the Profile for Sven2000  Click Here to Email Sven2000     
Hi again, i got problems with animations, i make a normal fountain and i want some rain efects in it. i place the fountain sprite and the i take the Magic rain efect and place it over the fountain. I want this sprite to look like it does when i cast the magic rain spell, so i press shift-4 (animation) and write in the sequence number(i didnt expect this to work) and it didnt work. Do i have to make a script and if yes, what should i write in that script?
FF4LIFE posted 02-25- 04:01 AM CT (US)     Click Here to See the Profile for FF4LIFE  Click Here to Email FF4LIFE     
You don't need a script, tho you could make one. All you need to do is hit 3 cor brain and put 6. This makes it loop the animation. If you wanted to make a script, you could make it like this:

void main(void)
{
sp_brain(¤t_sprite, 6);
}

Post New Topic  Post Reply
Hop to:


Contact Us | Prowler Productions

Powered by: Ultimate Bulletin Board, Freeware Version 5.10a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.