Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 6th, 2025, 10:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: "And" function in "IF" statements
PostPosted: January 8th, 2005, 7:20 pm 
Offline

Joined: January 6th, 2005, 8:56 pm
Posts: 330
Location: Houston, Republic of Texas
Opus: 8
OS: W7 Pro
System: Dell Precision T5500, 8 core Dual Xeon 2.13 GHz, 24 GB RAM, All SSD drives
Definitely a basic topic...however, it requires quite a few statements to get around this. Am I missing something? I was doing a level 3 exercises yesterday where I needed two separate scores on the same page to equal 4 in order for the student to pass. I kept looking for an "and" function to follow an "If" statement, i.e., "IF variable 1 is equal to 2 AND variable 2 is equal to 2 THEN set SCORE_CORRECT=PASS" Seems simple enough, but I had to create several variables and mess around about 2 hours to get it to work using other methods.

Perhaps I missed something...I haven't programmed much in a long time and just upgraded to XE from 4.1.

BTW...OPUS ROCKS!

Dave

_________________
An objective is a description of a performance you want your learners to be able to exhibit before you consider them competent.
Dr. Robert F. Mager, 1962

"If you can't measure it, it's crap."
David A. Mallette, 1980


Top
 Profile  
 
 Post subject:
PostPosted: January 8th, 2005, 7:42 pm 
May seem really basic, but you can just nest another 'if' inside the first 'if' to check for 2 conditions.


Top
   
 
 Post subject:
PostPosted: January 8th, 2005, 8:58 pm 
Offline

Joined: November 28th, 2004, 6:05 am
Posts: 141
Location: USA
Hi Mallette

if ((var1 == 2)&&(var2 == 2))
{
SCORE_CORRECT=PASS
}

or if you just need the total to be 4

if (var1+var2 == 4)
{
SCORE_CORRECT=PASS
}

HTH
Chris

_________________
Opus Resources and Services


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 8th, 2005, 10:26 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
If you are using the normal actions interface then FishBox is correct, simply nest the "if" statements.
If you are using scripting then Chris' suggestions are the way to go. Make sure you use the double ampersand (&&) - a single & is a bitwise AND, not a logical one, and will have a different effect. See this page for some more info


Top
 Profile Visit website  
 
 Post subject: Thanks
PostPosted: January 9th, 2005, 12:10 am 
Offline

Joined: January 6th, 2005, 8:56 pm
Posts: 330
Location: Houston, Republic of Texas
Opus: 8
OS: W7 Pro
System: Dell Precision T5500, 8 core Dual Xeon 2.13 GHz, 24 GB RAM, All SSD drives
Hey, not one, but two ways...
Haven't fully evaluated either, but they appear logical. Operating at the high level, I've not yet quite figured out the order Opus evaluates things. I was a bit confused as to why I couldn't place a global If or whatever at the top level.

As to Opus script, I've not even figured out where it's located yet...

Now THAT's BASIC!

Thanks for your help.

Dave

_________________
An objective is a description of a performance you want your learners to be able to exhibit before you consider them competent.
Dr. Robert F. Mager, 1962

"If you can't measure it, it's crap."
David A. Mallette, 1980


Top
 Profile  
 
 Post subject:
PostPosted: January 9th, 2005, 4:42 am 
Offline

Joined: November 28th, 2004, 6:05 am
Posts: 141
Location: USA
Dave

There are two ways to work with scripts

script objects and script actions

This type would normally be a script action which
is added like any other action associated with a trigger.
(like left mouse click)

Actions dialog >> programming >> script

HTH
Chris

_________________
Opus Resources and Services


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group