Page 2 of 3
Re: Random Pop-Ups
Posted: Wed Jul 13, 2011 6:10 pm
by Klaus
Hi Wayne,
unclewayne wrote:Where do i make the list?
I mostly use a button (on that card where your images are) and delete it after I used it.
unclewayne wrote:SO now i have a button at 150, 180 where do i list the IDs of my images? "list_with_image_IDs"
As I wrote, you can store this list (and anything else)
1. in a LOCAL variable
2. in a GLOBAL variable
3. in a (hidden) field
4. in a custom porperty
I think the easiest will be a FIELD in the moment, so put tIDList into any FIELD in your stack.
And I already took this into account this in my script but commented this line out:
Code: Select all
...
if (total_points >= 5) AND (total_points mod 5 = 0) then
set the ICON of btn "your button that shows the images here" to ANY line of fld "ID list"
end if
...
Best
Klaus
Re: Random Pop-Ups
Posted: Wed Jul 13, 2011 7:40 pm
by unclewayne
I owe you big when this is all done!!!
I have the script attached to my score field. I have all of my images in set to id 1-30 and set to invisible. i have a field named "tIDList". How do i list the id's on the tIDList's object inspector?
Re: Random Pop-Ups
Posted: Wed Jul 13, 2011 10:38 pm
by Klaus
Hi Wayne,
unclewayne wrote:How do i list the id's on the tIDList's object inspector?
Do you mean the "Content" part of the inspector? That is where you can PASTE the ID list.
Or just show the field, paste the list into the field and hide that field AFTER that
If that is what you mean...
Best
Klaus
Re: Random Pop-Ups
Posted: Wed Jul 13, 2011 11:38 pm
by unclewayne
Let me completely simplify it.
I have only 4 images now
Image Names= 1, 2, 3, 4
Image Id's= 8000, 8001, 8002, 8003
I have a hidden button called "facts"
I have a field called "score" that displays a score.
I have a blank hidden field called "iDlist".
Within "iDlist" in the inspector I have "8000, 8001, 8002, 8003" listed in the content area.
Attached to the "score" field I have:
if (total_points > = 5) AND (total_points mod 5 = 0) then
Set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
Still not working. Am I entering the list correct on the iDlist content?
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 12:12 am
by SparkOut
iDlist contains a single line string "8000, 8001, 8002, 8003" so "any line of iDlist" will contain that whole string.
You can change the contents of the field to be:
8000
8001
8002
8003
ie one image id per line.
Or (assuming you have not changed the itemDelimiter from the default comma) you can change the line that sets the id to
Set the ICON of btn "facts" to ANY item of fld "iDlist"
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 12:43 am
by unclewayne
I did have them listed. still not working?
does everything else look right?
Let me completely simplify it.
I have only 4 images now
Image Names= 1, 2, 3, 4
Image Id's= 8000, 8001, 8002, 8003
I have a hidden button called "facts"
I have a field called "score" that displays a score.
I have a blank hidden field called "iDlist".
Within "iDlist" in the inspector I have "8000, 8001, 8002, 8003" listed in the content area.
Attached to the "score" field I have:
if (total_points > = 5) AND (total_points mod 5 = 0) then
Set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 7:29 am
by SparkOut
Listed <> cr delimited
If you have a hidden button for which you are setting the icon, then do you actually show it at any point?
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 12:04 pm
by Klaus
Hi Wayne,
Attached to the "score" field I have:...
what do you mean "attached"? How is that script being triggered?
Just adding these lines does nothing!
Please post the complete script of your "score" field.
With "points calculation and display
handler" I mean of course the
handler that will put the points into the field "score"!
That is where you should "hook" the script snippet Ip suplied!
Best
Klaus
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 1:09 pm
by unclewayne
When i say attached i mean on the object script.
This is all that is attached to the score field:
if (total_points >= 5) AND (total_points mod 5 = 0) then
set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
This is attached to the object that is causing the score to go up:
-- Down
on constrainRectangularInit
end constrainRectangularInit
-- Up
on constrainRectangularExit
//Check to see if the slider is at the end when the user releases their finger.
/*This is the code that makes the next screen come up
switch the location of image "sliderKnob"
case 278, 202
add 1 to fld "score"
answer "FUCK YEAH!!" //Coder for when the slider reaches the end.
end switch
*/
move image "sliderKnob" to 124,177 in 300 milliseconds //Reset the location of the slider
set the blendLevel of field "unlockText" to distance(the location of graphic "startLine", the location of image "sliderKnob") //Set the opacity of the slider to lower as the slider returns home.
end constrainRectangularExit
-- Move
on constrainRectangularCallback
-- Get the distance of the start line & center theslider thumb
get distance(the location of graphic "startLine", the location of image "sliderKnob") //Get the distance that the slider has traveled so far.
put it into SliderDistance //Put that distance into a variable
divide sliderDistance by 2 //Divide it by 2 to get it to around 100
put round(SliderDistance) into sliderDistance //Round it to the nearest number to avoid errors.
if intersect (graphic "trigger", image "sliderKnob") then
add 1 to field "score"
move graphic "trigger" to 405, 199 in 1 millisecond
play (specialfolderpath("engine") & "/sounds/buzz2.mp3")
move image "shooter" to 600, 320 in .3 second
end if
if the left of image "sliderKnob" <= 160 then
move graphic "trigger" to 404, 199 in 1 millisecond
move image "shooter" to 295, 170 in .5 millisecond
end if
end constrainRectangularCallback
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 1:22 pm
by Klaus
Hi Wayne,
unclewayne wrote:When i say attached i mean on the object script.
unclewayne wrote:This is all that is attached to the score field:
if (total_points >= 5) AND (total_points mod 5 = 0) then
set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
Well, but these lines are not triggered anyhow!
OK, do this:
Add a new handler to your script of the object that is causing the score to go up
that does the POP-UP thingie and call it everytime after you ADD X to fld "score"!
Code: Select all
command do_the_popup
put fld "score" into total_points
if (total_points >= 5) AND (total_points mod 5 = 0) then
set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
end do_the_popup
unclewayne wrote:...
This is attached to the object that is causing the score to go up:
...
-- Up
on constrainRectangularExit
//Check to see if the slider is at the end when the user releases their finger.
/*This is the code that makes the next screen come up
switch the location of image "sliderKnob"
case 278, 202
add 1 to fld "score"
## !!!
do_the_popup
## !!! Add this everywhere where you change field score!
answer "FUCK YEAH!!" //Coder for when the slider reaches the end.
end switch
*/
move image "sliderKnob" to 124,177 in 300 milliseconds //Reset the location of the slider
set the blendLevel of field "unlockText" to distance(the location of graphic "startLine", the location of image "sliderKnob")
//Set the opacity of the slider to lower as the slider returns home.
end constrainRectangularExit...
Best
Klaus
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 3:41 pm
by unclewayne
Nope.
This is what I have on the slider script:
-- Down
on constrainRectangularInit
end constrainRectangularInit
-- Up
on constrainRectangularExit
move image "sliderKnob" to 124,177 in 300 milliseconds
set the blendLevel of field "unlockText" to distance(the location of graphic "startLine", the location of image "sliderKnob")
end constrainRectangularExit
command do_the_popup
put fld "score" into total_points
if (total_points >= 5) AND (total_points mod 5 = 0) then
set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
end do_the_popup
on constrainRectangularCallback
-- Get the distance of the start line & center theslider thumb
get distance(the location of graphic "startLine", the location of image "sliderKnob")
put it into SliderDistance //Put that distance into a variable
divide sliderDistance by 2 //Divide it by 2 to get it to around 100
put round(SliderDistance) into sliderDistance
if intersect (graphic "trigger", image "sliderKnob") then
add 1 to field "score"
move graphic "trigger" to 405, 199 in 1 millisecond
play (specialfolderpath("engine") & "/sounds/buzz2.mp3")
move image "shooter" to 600, 320 in .3 second
end if
if the left of image "sliderKnob" <= 160 then
move graphic "trigger" to 404, 199 in 1 millisecond
move image "shooter" to 295, 170 in .5 millisecond
end if
end constrainRectangularCallback
I really feel like it is something with the iDlist. It is calling the iDlist list but how does the iDlist know that 8000-8003 are image id's or even images for that matter?
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 3:51 pm
by Klaus
Hi Wayne,
you need of course to CALL this handler like I showed in my last mail (I even made that part BOLD

)
unclewayne wrote:Nope.
This is what I have on the slider script:
...
command do_the_popup
put fld "score" into total_points
if (total_points >= 5) AND (total_points mod 5 = 0) then
set the ICON of btn "facts" to ANY line of fld "iDlist"
end if
end do_the_popup
on constrainRectangularCallback
-- Get the distance of the start line & center theslider thumb
get distance(the location of graphic "startLine", the location of image "sliderKnob")
put it into SliderDistance //Put that distance into a variable
divide sliderDistance by 2 //Divide it by 2 to get it to around 100
put round(SliderDistance) into sliderDistance
if intersect (graphic "trigger", image "sliderKnob") then
add 1 to field "score"
## !!!
do_the_popup
## !!! Add this line everywhere where you add points to your field "score"!
move graphic "trigger" to 405, 199 in 1 millisecond
...
It is calling the iDlist list but how does the iDlist know that 8000-8003 are image id's or even images for that matter?
To quote Mr. Copperfield: "It's magic, ladies and gentlemen!"
The field "IDList" itself just holds a list of numbers, delimited by CR, but the engine knows what the images are that have this ID!
Best
Klaus
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 4:09 pm
by unclewayne
Two last issues:
The only way it works is if i have it set the button "facts" to visible. how would i have it set to invisible for the first 5? I can alway fake it by putting a slice of the background as the icon for the first 5.
Also it is only switching on the numbers that have 5 in it (5, 15, 25, 35, 45.....)
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 4:27 pm
by unclewayne
never mind the last post.
I fixed it. Thank you so much for all your help.
Now i am onto keeping the score in a database...
Re: Random Pop-Ups
Posted: Thu Jul 14, 2011 4:29 pm
by Klaus
Hi Wayne,
you're welcome!
unclewayne wrote:The only way it works is if i have it set the button "facts" to visible. how would i have it set to invisible for the first 5? I can alway fake it by putting a slice of the background as the icon for the first 5.
Set this for the button:
No border
No label
DISABLED (since this will only display the image)
VISIBLE!!!!!
If you set its icon to EMPTY, noone will see that button though

So you could do this on preopencard or whenever you need to NOT see an image in the button
...
set the icon of btn "facts" to empty
...
unclewayne wrote:Also it is only switching on the numbers that have 5 in it (5, 15, 25, 35, 45.....)
Hmm, the script including "X mod 5" does work here in my tests!? You are always adding ONE point to the score right?
Clueless...!?
Best
Klaus