The Dink Network

Reply to Re: Why Can't I Quit You, DinkC?

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
October 30th 2013, 01:58 PM
custom_coco.gif
Cocomonkey
Bard He/Him United States
Please Cindy, say the whole name each time. 
Arrrgh. Okay, can anybody tell me why my script that checks to see what you hit something with doesn't work?

It's called from other scripts like this...

void hit
{
external("hitcheck", "main")
if (&hitcheck == 1)
{
//hit text for fists
}

if (&hitcheck == 2)
{
//hit text for weapon 2
}

if (&hitcheck == 10)
{
//hit text for fireball
}


&hitcheck is a global I declared explicitly for this. I was using &jugb, but when it didn't work I tried giving it its own var to see if that fixed it. It didn't.

Here's the hitchecker script itself:

//hitcheck.c
void main
if (&missle_source == 1)
{
weapon()
}
else
{
//Okay, you threw SOMETHING at it
magic()
}
}

void weapon
{
&jugc = compare_weapon("item-fst")
if (&jugc == 1)
{
&hitcheck = 1
//1 then we know it's fist
return
}

&jugc = compare_weapon("item-swl")
//yes, this IS what I named my sword script
if (&jugc == 1)
{
&hitcheck = 2
//2 = sword 1
return
}

//more weapons to add here later
}

void magic
{
&jugc = compare_magic("item-fb")
if (&jugc == 1)
{
&hitcheck = 10
//10 is fireball
return
}
//more magic to add here later, I'll also check for the throwing axe
}


Sometimes it'll work, usually it won't. It'll read the sword as the fists for some absolutely unfathomable reason. I am banging my face into the keyboard over this.

Oh, and if you're wondering why I used compare_magic to see if you have the fireball equipped rather than looking for dam_fire, I tried that and it absolutely never worked, whereas I've had this method work for the fireball sometimes, despite it never once working for the sword. I have NO IDEA. I had a script's hit procedure just have Dink say "&hitcheck", and the fists and the fireball produce the expected values, but the sword gives whatever the value already was. Help?

Edit: Hell, I just noticed a missing equals sign in the sword check. How did I miss that the last five times I went over this? Ugh.

With that and a couple of changes to the calling scripts, I seem to have gotten this working properly. Sorry for bringing it up.