[FMX] Damn if else scripts

am a lil bit confused now. the game so far is starting to look pretty cool. putting aside all that actionscript bollox wat i really wat to say is:

if the ship is on ‘pad1’ hitTest
text should say pad1 _root.doing

if the ship is on ‘pad2’
text should say pad2

if the ship is on ‘pad3’
text should say pad3

if the ship isnt on any pad
text should say none

how do i do the last bit? a hit test for nothing?

the code i ave so far works like a charm

onClipEvent (enterFrame) {
if (_root.ship.hitTest(_root.fuel)) {
_root.doing = “Refueling”;
//statement(s);
} else if (_root.ship.hitTest(_root.home)) {
_root.doing = “Unloading”;
//statement(s);
} else if (_root.ship.hitTest(_root.pickup)) {
_root.doing = “Loading”;
//statement(s);
} else {
//statement(s);
}
}

is this right? please help with the bottom section? how do i say: if the ship is not landed, say: ‘flying’ or something similar?

please?

onClipEvent (enterFrame) {
if (_root.ship.hitTest(_root.fuel)) {
_root.doing = “Refueling”;
} else if (_root.ship.hitTest(_root.home)) {
_root.doing = “Unloading”;
} else if (_root.ship.hitTest(_root.pickup)) {
_root.doing = “Loading”;
} else {
_root.doin = “nothing”
}

that should work, if it dozn’t try this one…

onClipEvent (enterFrame) {
if (_root.ship.hitTest(_root.fuel)) {
_root.doing = “Refueling”;
}
if (_root.ship.hitTest(_root.home)) {
_root.doing = “Unloading”;
}
if (_root.ship.hitTest(_root.pickup)) {
_root.doing = “Loading”;
}
if (!_root.ship.hitTest(_root.pickup) and !_root.ship.hitTest(_root.home and !_root.ship.hitTest(_root.fuel){
_root.doin = “nothing”;
}

hope it works

thanks v.much but neither of those scripts work,

:tie: The 1st one doesnt make any difference and the 2nd one:
onClipEvent (enterFrame) {
if (_root.ship.hitTest(_root.fuel)) {
_root.doing = “Refueling”;
}
if (_root.ship.hitTest(_root.home)) {
_root.doing = “Unloading”;
}
if (_root.ship.hitTest(_root.pickup)) {
_root.doing = “Loading”;
}
if (!_root.ship.hitTest(_root.pickup) and !_root.ship.hitTest(_root.home and !_root.ship.hitTest(_root.fuel){
_root.doin = “nothing”;
}

on the output page it says:

Scene=Scene 1, Layer=ship, Frame=2: Line 11: ‘)’ or ‘,’ expected
if (!_root.ship.hitTest(_root.pickup) and !_root.ship.hitTest(_root.home and !_root.ship.hitTest(_root.fuel){

Scene=Scene 1, Layer=ship, Frame=2: Line 12: ‘)’ expected
_root.doin = “nothing”;

i really cant figure this one out at all. :*( :angry: :frowning:

any ideas?

if your 555 then im 666

Hiya mate i think this solves your problem…

onClipEvent (enterFrame) {
if (_root.ship.hitTest(_root.fuel)) {
_root.doing = “Refueling”;
//statement(s);
} else if (_root.ship.hitTest(_root.home)) {
_root.doing = “Unloading”;
//statement(s);
} else if (_root.ship.hitTest(_root.pickup)) {
_root.doing = “Loading”;
//statement(s);
} else {
_root.doing = “Flying”;
updateAfterEvent();
//statement(s);
}
}

root.doing = “Flying”;
updateAfterEvent();

you need the update after event to update the variable. Hope that helps

Nice one, thats proper top! :tie: :stuck_out_tongue: :beam:

wonder if you can help me with this one.

I want this code 2 add the _root.cargo total 2 my score points but only wen the ship has unloaded the cargo. i have posted the .fla so you can see wat i mean.

the code i have so far is:

onClipEvent (enterFrame) {
if (_root.ship.hitTest(_root.pickup)) {
_root.cargo = parseInt(_root.cargo)+1;
_trace(_root.score);
if (_root.cargo>=2) {
_root.cargo = 2;
}
_root.cargo += 0;
//statement(s);
} else if (_root.ship.hitTest(_root.home)) {
_root.cargo = parseInt(_root.cargo)-1;
_trace(_root.score);
if (_root.cargo<=0) {
_root.cargo = 0;
}
_root.cargo -= 0;
}
}

is this code anywhere close to wat i need?

plz help.

Keep the gun well oiled and the temple clean, sh*t, snort and blastpheme.

I aint sure what you mean but is this what u want?

wicked man,. that kicks ***. thank you so much =) :tie:

am fairly new to all this actionscriptin lark but i think its cme 2gether quite well with a lil help here and there. hopefully i can do sum more stuff by myself n maybes help others in return now :goatee: :bounce: :cool:

thanks v.much

white trash get down on your knees, time for cake and sodomy.

Sound of Society

is it possibe to make the _root.cargo ammount increase slowly, ie: a number per second, so that you have the choice of how much cargo to collect rather than it just speeding on up to 20 n u have no choice?

can this b done?

Getting high on violence baby.