What am I doing wrong here?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm
Location: USA

What am I doing wrong here?

Post by shawnblc » Wed Apr 24, 2013 6:32 am

What am I doing wrong here?

Code: Select all


on mouseUp
   if grpA1 = correctAnswer then
  add 5 to field "fldCorrect"
else
   add 5 to field "fldWrong"
   end if
end mouseUp


Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: What am I doing wrong here?

Post by Simon » Wed Apr 24, 2013 6:36 am

Need to know what grpA1 and correctAnswer is.
Otherwise it's perfect. :D


Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm
Location: USA

Re: What am I doing wrong here?

Post by shawnblc » Wed Apr 24, 2013 6:42 am


Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: What am I doing wrong here?

Post by Simon » Wed Apr 24, 2013 7:06 am

Button Next:

Code: Select all

global gScore,correctAnswer
on mouseUp
   put the hilitedButtonName of group "grpA1" into gScore
   put 2 into correctAnswer
   go next
end mouseUp
Button Grade Quiz

Code: Select all

global gScore,correctAnswer
on mouseUp
   if gScore = correctAnswer then
  add 5 to field "fldCorrect"
else
   add 5 to field "fldWrong"
   end if
end mouseUp
Ok, so you have to store information somewhere that is what the globals are for. correctAnswer and gScore must be filled before you do a comparison. (if gScore = correctAnswer then)

I suggest you go through the video's here:
http://runrev.com/developers/documentat ... rs-course/

Have Fun!
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm
Location: USA

Re: What am I doing wrong here?

Post by shawnblc » Wed Apr 24, 2013 7:09 am

Ah, I think I understand what you're saying. I'll give it another whirl and continue my LC education. It's a rather slow process for me.

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 153
Joined: Thu Jun 29, 2006 4:16 pm

Re: What am I doing wrong here?

Post by Randy Hengst » Wed Apr 24, 2013 3:17 pm

I'd be happy to take a look, too. But the link to your stack didn't work.

be well,
randy

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm
Location: USA

Re: What am I doing wrong here?

Post by shawnblc » Wed Apr 24, 2013 5:43 pm

Randy Hengst wrote:I'd be happy to take a look, too. But the link to your stack didn't work.

be well,
randy
Simon's input helped greatly.

I took the stack down, will update it later.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”