|
metadata
Hey i was making a game where you did a mission .
At the start Mission was 0 so that all the people involved in the mission would not talk to you .
And when you talked to the guy the started the mission it would set mission to 2
and when you talked to the mission ender it was set to 3
and when you got the reward it was set to 4
but when you talk to the mission starter it just goes straight to the mission complete frame heres the code
on (release) {
if (\_root.mission=0) {
gotoAndPlay(“sam”);
}
if (\_root.mission=1) {
gotoAndPlay(“doneyet”);
}
if (_root.mission=3) {
gotoAndPlay(“missiondone”);
}
if (_ root.mission=4) {
gotoAndPlay(“donedone”);
}
}
|
|
|
metadata
|
|
|
metadata
You need to use `==` to check if two things are equal.
Honestly, the Actionscript compiler should throw _some_ kind of warning for this.
|
|
|
metadata
Hey thanks so much you just saved my game
|
|
|
metadata
> *Originally posted by **[Jabor](/forums/4/topics/44279?page=1#posts-961389):***
>
> You need to use `==` to check if two things are equal.
>
> Honestly, the Actionscript compiler should throw _some_ kind of warning for this.
I agree, it should. I haven’t figured out why not.
|
|
|
metadata
> *Originally posted by **[Draco18s](/forums/4/topics/44279?page=1#posts-965204):***
> > *Originally posted by **[Jabor](/forums/4/topics/44279?page=1#posts-961389):***
> >
> > You need to use `==` to check if two things are equal.
> >
> > Honestly, the Actionscript compiler should throw _some_ kind of warning for this.
>
> I agree, it should. I haven’t figured out why not.
Perhaps because it’s VERY solid actionscript syntax? (it only doesn’t do what you want)
|
|
|
metadata
> *Originally posted by **[Vara](/forums/4/topics/44279?page=1#posts-965213):***
> > *Originally posted by **[Draco18s](/forums/4/topics/44279?page=1#posts-965204):***
> > > *Originally posted by **[Jabor](/forums/4/topics/44279?page=1#posts-961389):***
> > >
> > > You need to use `==` to check if two things are equal.
> > >
> > > Honestly, the Actionscript compiler should throw _some_ kind of warning for this.
> >
> > I agree, it should. I haven’t figured out why not.
>
> Perhaps because it’s VERY solid actionscript syntax? (it only doesn’t do what you want)
When would it ever do what you want?
|
|
|
metadata
`
if( lastBlob ) { continuePreviousBlobbing(); }
if( lastBlob = blob ) {
trace( "blob!" );
doBlobbing();
blob = false;
}
`
That is an example of correct use of such a structure. It is a lazy way to assign a variable (probably because you’re about to overwrite it) and then do stuff, all in one line. It is, however, very unlikely that you can create a situation where you cannot simply split this into two statements:
`
lastBlob = blob;
if( blob ) {
...
`
|
|
|
metadata
It’s handy when you work with functions that return a value but also change other variables.
For instance, if you had a string parsing function like nextWord() that eventually returned null at the end of text it was working with, but moved an internal index, you wouldn’t want to call it until you meant it. So;
while (word = nextWord())
{ // process word }
|
|
|
metadata
At any rate, I’ve had the Flash CS3 IDE warn me about assignments inside if-tests. Are you using a different tool, or do your project settings disable them somehow? I’m away from my computer at the moment.
|