Prowler Productions
  Dink Smallwood Forum
  Find the error in the script (please)

Post New Topic  
profile | register | faq

Author Topic:   Find the error in the script (please)
Tamtur posted 05-22- 04:50 AM CT (US)   Click Here to See the Profile for Tamtur   Click Here to Email Tamtur  
Well, maybe my flashcard program wouldn't have worked even if I had variables that could hold words. I changed my scripts to avoid the need, but when I click on the flashcard (to flip to side two) it flips... and the word from side one appears. And when I click "next" to go to card 2 it flips... and the word from card one, side one reappears. The debug file keeps saying that "flashcard.c does not know variable &side" or some such thing - but I put them in the main proc of main.c along with the other global variables. Is there something else I need to do?

Here is the script if you want to take a look, I'm pretty sure that if I could get it to remember the variables it would work:

in the main proc of main.c
make_global_int("&side", 1);
make_global_int("&numcard", 1);
make_global_int("&lang", 1);

flashcard.c (which is called when I click on the flashcard or a "flip" button):
void click ( void )
{
debug ("side var was &side");
If (&side == 2) &side = 1;
If (&side == 1) &side = 2;
debug ("side var is now &side");
flip();
external ("data", "data");
}

void flip (void)
{
//I flip the card over here, it works so I won't waste space
}

next.c (to go to the next card)
void click ( void )
{
debug("This is the next string");
If (&nextcard >= 12)
{
&nextcard = 1;
} else
{
&nextcard += 1;
}
&side = &lang
external ("flashcard", "flip");
external ("data","data");
}
prev.c works the same as next.c

a sample of data.c:
void data (void)
{
If (&numcard == 1)
{
If (&side == 1) say_xy(" amiko ", -40, 170);
If (&side == 2) say_xy(" friend ", -40, 170);
return;
}
If (&numcard == 2)
{
If (&side == 1) say_xy(" filo ", -40, 170);
If (&side == 2) say_xy(" son ", -40, 170);
return;
}
//and so on
}

All your help is very much appreciated
thanks.

Drakeman posted 05-22- 06:22 AM CT (US)     Click Here to See the Profile for Drakeman  Click Here to Email Drakeman     
Just looking at the first if statements... you should probably use if... else combination. As if &side == 2 will change &side to 1 if true, but the next if statment will change it back to 2 again.

if (&side == 2)
{
&side = 1;
} else
{
&side = 2;
}

Haven't looked at the rest of the script ... hope this helps

Tamtur posted 05-22- 02:21 PM CT (US)     Click Here to See the Profile for Tamtur  Click Here to Email Tamtur     
Thanks Drakeman, I'll try that. But it appears (to me) that the script is OK - it's just not remembering the global variables.

I even tried deleting some of the old globals with no luck.
I put them in main.c in the flashcards' story folder, along with the others, and I thought that was all that's necessary.

Any suggestions?

Tamtur posted 05-22- 02:55 PM CT (US)     Click Here to See the Profile for Tamtur  Click Here to Email Tamtur     
I tried changing all the 'if' statements that I could to the syntax you suggested and it fixed almost everything. Thanks.

The only problem I still had was one of the variables but when I looked closer I'd just made a typo in main.c when I initted it.

Guess I won't use the shortcut 'if' statement anymore :)

Thanks again

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.