HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... Error on Checkhit
Error on Checkhit
  View type:
I have built a simple drag and drop, with several text boxes able to be dropped onto an image target. Conditional checks are made with the following actions in the image:

CHECKHIT(...)
MSGBOX(...)
CHECKHIT(...)
MSGBOX(...)

It couldn't be much simpler. If the first condition holds, everything is fine. If the second condition holds, an error occurs after the msgbox is executed:

Line..., Char 3; Invalid argument, Code 0

Happens on XP ans Win 7, 32 and 64 bit.

Any ideas please?

Mike
 
Hi Mike
I get the same error + things don't go as expected.
I have the checkhit statement then an indented msgbox. Below that is another checkhit with another msgbox. There are 6 altogether.
My project is a simple drag and drop sentence builder for my daughter. It seems to work for the first target, but then when I build the second target the first word comes out of the box.
I have tried so many different combinations, but obviously missing the right one. [:(]
 
 
Is this related to the sequence of events or how they are evaluated?
To be using a long sequential list implies the evaluation has been set at page level...
The events are simple:
The object (text block or image) gets dragged to a position, check position and evaluate and leave in place if good.
...
A series of checks like this is not easy to evaluate using a sequence of checkhits from page level; and a series of simple IF THEN AND statements aren't the best way to evaluate this kind of thing.
Reason being the first checkhit has occured already so the sequence of checks won't complete.. ever ..
I'd suggest trying the evaluation at object level so the evaluations are per item, this also allows the excercise to be non-linear.
Move the object, drop and evaluate. If the position is good then it stays in place, if not drop back to the start position.
Each object increments the counter on correct then evaluates for completion, a common hidden text message can be used on completion.
 
 
 
Sounds like a good idea Nick and that should get rid of the 'Line 609 Char 3 g_o DragObject is null or not an object' message as well.
Can you give me an example of the sort of code I would use from the scripts please?
 
 
 
 
Sorry Nick I didn't answer your question.
The scripts are on the drop target text box, 6 of them.
 
 
 
 
 
I think that's what's doing it then Peter, at least to make it work anyway. They should have discrete drop targets so each is evaluated by itself.
It might clear up the error which seems to be saying that one of the draggable objects isn't.
If I get the spare time I'll toss something together and see if I can get it to work.
 
 
 
 
 
 
I had the same problem. Three different text boxes were to be dragged onto a transparent notifier Object. At first my code looked like this:
CHECKHIT(txtBox1)
MOVE txtBox1 to spec. loc.
CHECKHIT(txtBox2)
MOVE txtBox2 to spec. loc.
CHECKHIT(txtBox3)
MOVE txtBox3 to spec. loc.

I always got an error message when the user dragged txtBox1 and txtBox2 first.

This code worked for me:
VARIABLE hit1=0;
VARIABLE hit2=0;
CHECKHIT(txtBox1)
VARIABLE hit1=1
DO things
IF hit1==0
CHECKHIT(txtBox2)
VARIABLE hit2=1
DO things
IF hit2==1
CHECKHIT(txtBox1)
VARIABLE hit1=1
DO things

This way anytime one of the textboxes was really dragged onto the Notifier, the other CHECKHIT wouldn't be processed and trigger the error.

Hope I helped

Have a nice day [:)]

Gilles
 
 
 
 
 
 
 
The indent didn't come out in the forum message. Sorry. I hope this is clearer:
VARIABLE hit1=0;
VARIABLE hit2=0;
CHECKHIT(txtBox1)
__VARIABLE hit1=1
__DO things
IF hit1==0
__CHECKHIT(txtBox2)
____VARIABLE hit2=1
____DO things
__IF hit2==1
____CHECKHIT(txtBox1)
______VARIABLE hit1=1
______DO things
 
 
 
 
 
 
 
 
Must be the tiredness form hours of CourseLabbing, but here the last very correct code (in the last IF hit==2 statement, it is txtBox3 that is tested not txtBox1)
VARIABLE hit1=0;
VARIABLE hit2=0;
CHECKHIT(txtBox1)
__VARIABLE hit1=1
__DO things
IF hit1==0
__CHECKHIT(txtBox2)
____VARIABLE hit2=1
____DO things
__IF hit2==1
____CHECKHIT(txtBox3)
______VARIABLE hit1=1
______DO things
 
 
 
 
 
 
 
 
 
The indent is a pain, especially when you try to show something here!
Nice Gilles
It's going to get a bit convoluted with 5 or 10 objects though
 
 
 
 
 
 
 
 
 
 
I have a lot of self designed tests like a grid where you have to place syllables to form words which work exactly the way you describe. They only work reliably in Courselab 2.3 with the code you posted, not in 2.4. And that only in IE anyway.

Juergen
 
These actions are all wrapped up in if then statements??
Subject:
Message options
No additional options