Page 1 of 1

Why doesnt this work??? :?

PostPosted: Thu Jan 31, 2008 9:34 pm
by GuitarManGuitar
this works fine...

COLLISION ANY SIDE OF ANY ACTOR
///WIZARD HAT PICK UP
{collide.itemtype = strcmp(collide.name, wizhat.name);

if(collide.itemtype==0)
ChangeParent("Collide Actor", "menu"),
collide.x=-30+(menuquan*2),
collide.y=-48,
menuquan=menuquan+10, wizhat.itemown=1;}


but this doesn't

MOUSE BUTTON DOWN (LEFT)
if(hatequip==1)
ChangeParent("Event Actor", "(none)"),
x=999999999,
itemown=0, hatequip=0,
y=Man.y,wizhat.x=Man.x;

if(hatequip==0)
if(itemown==1)
ChangeParent("wizhat", "Man"),
wizhat.x=0,
wizhat.y=-11,
menuquan=menuquan-10,hatequip=1;


the second script is supossed to move the hat from your inventory (menu) to your head (Man).
Can you tell me y it doesn't work and how to fix it?

Re: Why doesnt this work??? :?

PostPosted: Thu Jan 31, 2008 11:23 pm
by Super Pieman
you have to put a "{" after using an if statement.
the code should look like this
Code: Select all
MOUSE BUTTON DOWN (LEFT)
if(hatequip==1)
{
ChangeParent("Event Actor", "(none)"),
x=999999999,
itemown=0, hatequip=0,
y=Man.y,wizhat.x=Man.x;
}

if(hatequip==0)
{
if(itemown==1)
{
ChangeParent("wizhat", "Man"),
wizhat.x=0,
wizhat.y=-11,
menuquan=menuquan-10,hatequip=1;
}
}


for the second peice of code you have to if options so you have to end with 2 "}"s

EDIT: Nvmd I just realized what you were saying. Im not sure how to fix your problem

Re: Why doesnt this work??? :?

PostPosted: Fri Feb 01, 2008 12:10 am
by GuitarManGuitar
Super Pieman wrote:you have to put a "{" after using an if statement.
the code should look like this
Code: Select all
MOUSE BUTTON DOWN (LEFT)
if(hatequip==1)
{
ChangeParent("Event Actor", "(none)"),
x=999999999,
itemown=0, hatequip=0,
y=Man.y,wizhat.x=Man.x;
}

if(hatequip==0)
{
if(itemown==1)
{
ChangeParent("wizhat", "Man"),
wizhat.x=0,
wizhat.y=-11,
menuquan=menuquan-10,hatequip=1;
}
}


for the second peice of code you have to if options so you have to end with 2 "}"s

EDIT: Nvmd I just realized what you were saying. Im not sure how to fix your problem


Can anyone help me???

Re: Why doesnt this work??? :?

PostPosted: Fri Feb 01, 2008 1:13 am
by pyrometal
Are ending your instructions with (,) or (;) ?? A command must always be followed by a semicolon and not a comma. I'm noticing the way you wrote your lines in your text were ended in commas so I just want to make sure.

Re: Why doesnt this work??? :?

PostPosted: Fri Feb 01, 2008 1:25 am
by GuitarManGuitar
thats not it, when u try to wear the hat by clicking on it, it goes back to the menu and then disapears!

Re: Why doesnt this work??? :?

PostPosted: Fri Feb 01, 2008 1:44 am
by pyrometal
Code: Select all
MOUSE BUTTON DOWN (LEFT)
if(hatequip)
{
    ChangeParent("Event Actor", "(none)");
    hatequip=0;
    y=Man.y;
    x=Man.x;
}

else
{
    if(itemown)
    {
        x=Man.x;
        y=Man.y-11;
        ChangeParent("wizhat", "Man");
        menuquan=menuquan-10;
        hatequip=1;
    }
}

Re: Why doesnt this work??? :?

PostPosted: Fri Feb 01, 2008 11:11 pm
by GuitarManGuitar
didn't work.

Re: Why doesnt this work??? :?

PostPosted: Sat Feb 02, 2008 2:23 am
by pyrometal
Sorry, then I don't know the reason for your problem...

Re: Why doesnt this work??? :?

PostPosted: Sun Feb 03, 2008 11:01 am
by Thanx
I think if this doesn't work, then the problem will not be in this part of the code.

Code: Select all
if(hatequip==1)
{
    ChangeParent("Event Actor", "(none)"),
    x=999999999;
    itemown=0;
    hatequip=0;
    y=Man.y;
    wizhat.x=Man.x;
}

if(hatequip==0)
{
    if(itemown==1)
    {
        ChangeParent("wizhat", "Man"),
        wizhat.x=0;
        wizhat.y=-11;
        menuquan=menuquan-10;
        hatequip=1;
    }
}

I had if statement problems lately, and if that doesn't work, then let me give you a hint: You might have statements put in the wrong if statements, so they're done the wrong time, if at all, or you might have an if statement you don't need at all.