📧 Message Board Archive

What is wrong with this script?
Basically, the i=1 to 4800 loop is failing.

Dink doesn't say anything after he is damaged, and he doen't lose health from the poison.



void main( void )

{

int &i;

//test for i being odd is taking 2 * (i / 2)

int &halfi;

//test of whether dink's been hit is checking if his health has changed

int &lifehold;

//"boolean"(0 or 1) poison variable

int &poisoned;

int &storyhold;



//borrowing a global for anti poison enemy bonuses

//some weapons scripts include:

//if (&story == 219) &strength += 10;

//and similar things

&storyhold = &story;

&story = 219;



&i = 1;

//Dink at beggining isn't damaged

&lifehold = &life;

//Dink at beggining isn't poisoned

&poisoned = 0;



sp_brain(&current_sprite, 9);

sp_speed(&current_sprite, 1);

sp_timing(&current_sprite, 33);

sp_exp(&current_sprite, 125);

sp_base_walk(&current_sprite, 380);

sp_base_death(&current_sprite, 380);

sp_defense(&current_sprite, 3);

sp_touch_damage(&current_sprite, 7);

sp_hitpoints(&current_sprite, 70);

sp_target(&current_sprite, 1);



freeze(&current_sprite);

freeze(1);

say("'4I'm from the snake gang, and I want your money!", &current_sprite);

unfreeze(1);

unfreeze(&current_sprite);

screenlock(1);

loophere:

if (&i < 999)

{

     wait(250);

     if (&life != &lifehold) &poisoned = 1;

     if (&poisoned = 1)

           {

           &halfi = &i / 2;

           &halfi *= 2;

           //If dink is poisoned and i is even, take off life

           if (&i == &halfi)

                 {

                 say("Argh, this poison is strong!", 1);

                 &life -= 1;

                 draw_status();

                 }

           }

&i += 1;

goto loophere;

}

}
Re: What is wrong with this script?
: Basically, the i=1 to 4800 loop is failing.



: Dink doesn't say anything after he is damaged, and he doen't lose health from the poison.



: void main( void )



: {



: int &i;



: //test for i being odd is taking 2 * (i / 2)



: int &halfi;



: //test of whether dink's been hit is checking if his health has changed



: int &lifehold;



: //"boolean"(0 or 1) poison variable



: int &poisoned;



: int &storyhold;



: //borrowing a global for anti poison enemy bonuses



: //some weapons scripts include:



: //if (&story == 219) &strength += 10;



: //and similar things



: &storyhold = &story;



: &story = 219;



: &i = 1;



: //Dink at beggining isn't damaged



: &lifehold = &life;



: //Dink at beggining isn't poisoned



: &poisoned = 0;



: sp_brain(&current_sprite, 9);



: sp_speed(&current_sprite, 1);



: sp_timing(&current_sprite, 33);



: sp_exp(&current_sprite, 125);



: sp_base_walk(&current_sprite, 380);



: sp_base_death(&current_sprite, 380);



: sp_defense(&current_sprite, 3);



: sp_touch_damage(&current_sprite, 7);



: sp_hitpoints(&current_sprite, 70);



: sp_target(&current_sprite, 1);



: freeze(&current_sprite);



: freeze(1);



: say("'4I'm from the snake gang, and I want your money!", &current_sprite);



: unfreeze(1);



: unfreeze(&current_sprite);



: screenlock(1);



: loophere:



: if (&i < 999)



: {



:   wait(250);



:   if (&life != &lifehold) &poisoned = 1;



:   if (&poisoned = 1)



:   {



:   &halfi = &i / 2;



:   &halfi *= 2;



:   //If dink is poisoned and i is even, take off life



:   if (&i == &halfi)



:   {



:   say("Argh, this poison is strong!", 1);



:   &life -= 1;



:   draw_status();



:   }



:   }



: &i += 1;



: goto loophere;



: }



: }



The lines bolded above are wrong, and detailed below.



if (&life != &lifehold) &poisoned = 1;



You can't mess with variables on the same line as an if statement.  You have to do this instead:



if (&life != &lifehold) {

&poisened = 1;

}



&halfi = &i / 2;



Dink doesn't support cool math... at all.  So you have to do this instead:



&halfi = $i;

$halfi / 2;



&halfi *= 2;



When using / and *, you don't use the = sign.  So do this instead to double &halfi:



&halfi * 2;
Re: What is wrong with this script?
Thanks
Anything else?
I changed the loop to this:





loophere:

if (&i < 999)

{

     wait(250);

     if (&life != &lifehold)

     {

     &poisoned = 1;

     }

     if (&poisoned = 1)

           {

           &halfi = &i;

           &halfi / 2;

           &halfi * 2;

           //If dink is poisoned and i is even, take off life

           if (&i == &halfi)

                 {

                 say("Argh, this poison is strong!", 1);

                 &life -= 1;

                 draw_status();

                 }

           }

&i += 1;

goto loophere;

}



Any obvious problems?
Re: Anything else?
It still doesn't work BTW.
Re: Anything else?
: It still doesn't work BTW.

remember that problem with variabs?

$applea

$appleb can be used but not



$apple

$applea

because it confuses the variables. So I think you might whant to change the $lifehold and the $storyhold to $zlifehold and $zstoryhold respectivly. I'm not sure though if the problem is only to globals, or if its between globals and locals....

I'll give it a shot... <sup>[NT]</sup>
[No message content]
Didn't work
I also changed the name of &i to &ixa
Re: Didn't work
There might still be some minor problem in your script. For example, you forgot to use == in if statement. But one probable (and main) problem I suspect is about the use of &life. I had some difficulties in dealing with those global variables used in hard codes as well (like &life, &exp...). They don't seem to work the same way as other global and local variables. My suggestion is you make a local variable &whatever and let &whatever = &life and use &whatever instead of &life. And if you want to change &life, you can let &life = &whatever. I don't have much success in putting &life in the condition bracket of the if statement. I could be wrong, though.



Re: Didn't work
Since this enemy was a touch damage one, I changed poisoned to a global variable and set it to one in the touch() procedure.  Still no luck!



The outer loop runs fine(Diagnostic was putting in a statement like this: if (&i > 4) say("Diagnostic", 1); and dink said diagnostic), but the inner loop thinks poisoned = 0.  When I put the diagnostic line: say("&posioned", 1); in the touch() proc, after I changed posioned, it said "1", but when I put it in the loop it said "0".



I think I'll just rewrite the script entirely and poison dink in the touch() proc.
Worked... but my mouse is broken...
I rewrote the script and it works now, but my mouse broke because it is OLD.  Do you have any idea how hard it is to use the net without a mouse??  With win98??
Re: Worked... but my mouse is broken...
: I rewrote the script and it works now, but my mouse broke because it is OLD. Do you have any idea how hard it is to use the net without a mouse?? With win98??



Fun with alt, tab, alt+tab, and crtl-alt-delete. :) (and thouse stupid websites with frames)

At least your computer has a mouse. I've got a few that don't have mouse ports.

Now that is oLd sKooL.

:)