×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Variable confusion

Variable confusion

Variable confusion

(OP)
I am currently creating an educational application using director.

I have had little training in this software though and i have come into some difficulties when trying to create a quiz section.

I want to have 10 questions with buttons that you press to advance, and i want to keep track of the score as they progress through the quiz using variables. So for example

if they push the correct button i want it to go to "question 2" and then something like myVariable = myVariable + 2

so that when it gets to the end of the quiz it will check this variable and go to a certain page depending on how well they scored.

eg.

on mouseUp me
  if myVariable = <5 then
    go to "bronze"
  else if myVariable = 5> then
    go to "gold"
  end if
end



Any help would be appreciated...thanks

Peter Butler
Tandokuno Design

RE: Variable confusion

Your strategy and the script is fine, just add global variable declaration wherever "myVariable" appears, i.e. "global myVariable".

Kenneth Kawamoto
www.materiaprima.co.uk

RE: Variable confusion

(OP)
Thanks very much i have that working ^_^

The only problem i seem to have now is with the script on the start button.

I have got some editable text fields on the first welcome page of the quiz, these take the childs Name, Age, Class and School. This is done so that on the last page of the quiz a certificate can be shown with all these details etc..

Here is the script i placed on the button, if you would be so kind as to instruct me of what is wrong on it i would be very grateful (as it keeps giving me a script error).

_____________________________________________

on mouseUp me
  if member(52).text = "" then
    alert("please Enter Your Name")
  else
    member(58).text = "Congratulations" & RETURN & RETURN && member(52).text
&& "has successfully completed the sewerby challenge" & RETURN & RETURN && member(52).text
&& "aged" && member(53).text && "from class" && member(54).text && "at" && member(55).text
&& "scored" member(22).text & RETURN & RETURN "Well Done!!!!"
  end if
end

_____________________________________

And the error i get is:

Script error: Comma expected

&&"scored" member(22).text & RETURN & RETURN
"Well Done!!!!"?

________________________________________

Thanks again

Peter Butler
Tandokuno-Design.com

RE: Variable confusion

(OP)
tried inserting that and still no joy :(

on mouseUp me
  if member(52).text = "" then
    alert("please Enter Your Name")
  else
    member(58).text = "Congratulations" & RETURN & RETURN && member(52).text\
    && "has successfully completed the sewerby challenge" & RETURN & RETURN && member(52).text\
    && "aged" && member(53).text && "from class" && member(54).text && "at" && member(55).text\
    && "scored" member(22).text & RETURN & RETURN && "Well Done"
  go to 5  
  end if
end

it came up with a new error though, says 'expected end of statement"

any ideas?

(thankyou for your patience btw, its very hard to find people that are good at director, and most textbooks arent very good)

Peter Butler
Tandokuno Design

RE: Variable confusion

(OP)
Thanks Kenneth thats great !!!

Just one final problem ^_^ everything you said works perfect the only element that doesnt work is the score bit. I thought this might be because it uses a global variable?

with this:

on mouseUp me
  if member(52).text = "" then
    alert("please Enter Your Name")
  else
    member(58).text = "Congratulations" & RETURN & RETURN && member(52).text\
    && "has successfully completed the sewerby challenge" & RETURN & RETURN && member(52).text\
    && "aged" && member(53).text && "from class" && member(54).text && "at" && member(55).text\
    && "scored" && member(22).text & RETURN & RETURN && "Well Done"
  go to 5  
  end if
end

it displays it as 0 regardless of what you score... I tried replacing the && member(22).text with && myVariable but it still shows it as 0. I remmbered to put the 'global myVariable' at the top so it's not that ? hmm

any ideas?

also how did you learn to use director so well? you are such an asset to this forum thanks for all the help you give people. I've ordered a Lingo in a nutshell book which im hoping might help me learn this coding.

Peter Butler
Tandokuno Design

(Ill show you the finished project when its done ^_^)

RE: Variable confusion

If you get 0 that means myVariable is 0. Type in the message window:
--
put myVariable
--


What do you get?

I learned Director initially at college but real learning all came from doing work. If you have to deliver something there's no choice but you have to learn quickly and complete the task!

Kenneth Kawamoto
www.materiaprima.co.uk

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close