Page 1 of 1
send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 8:44 am
by jon
Hi,
Please offer me advice before I go crazy

Here is my problem.
I have a row of 6 btns, they may ( if the user chooses ) be clicked one after the other quickly.
When a single btn is clicked it triggers an image to move from one Loc to another Loc with an instant vis effect dissolve.
of course that trigger blocks the next btn click until it's completed. I need to click the next and multiple btns, each with
a similar effect without having to wait until trigger is finished.
I understand it's something to do with "send" and I have downloaded the Message_Mechanics stack and also worn the forum
search engine out. I am still struggling, I have put my basic code to show where I am with this.
Code: Select all
if the icon of the target = "1275" then
doHideScores
set the Loc of image "plus500.png" to the Loc of the target
show image "plus500.png"
//send me to tNutHouse in 700 millisecs because
// I am banging my head on the wall
//and most of my hair has fell out with frustration
hide image "plus500.png" with visual effect dissolve fast
DoSounds1275
add 1 to fld "sclik"
put fld "sclik" into sCliktmp
if sCliktmp = 6 then
play ac "warpath.wav"
end if
end if
Thank you, Jon.
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 9:07 am
by jmburnod
Hi Jon,
Instead
Code: Select all
send me to tNutHouse in 700 millisecs
try
Code: Select all
send tNutHouse to me in 700 millisecs
Best regards
jean-Marc
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 9:28 am
by jon
Thank you jean-Marc,
I will try it.
Regards, Jon
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 11:12 am
by Klaus
Hi Jon,
jon wrote:..I will try it.
really no need to try, this will work!
Hint: If something sounds logically OK in plain english, then it will probably work exactly like this in LiveCode!
"Send ME to letter" VS "Send letter to me"
Best
Klaus
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 5:18 pm
by jon
Thanks Klaus and jean-Marc
Yes I understand that,:)
Your code of course is correct, but I have deleted all code related to the above efforts because it was all getting too cluttered and complex fo me.
I am goint to start from the beginning again in order to try to learn how to get this send in time stuff working with the above code, I think I maybe over complicating it.
I can't get my head round it by reading the dictionary help files.
It's obviously my other code that was wrong, I can't seem to work out the logic of "send in time"
can you point me in the right direction perhaps with a little psuedo code and words of one syllable,
I am not asking for code from you kind people because I do want to be able to understand how to do this myself, but I am becoming totally lost with this one.
As always, thank you for your efforts. Jon
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 6:01 pm
by Klaus
Hi Jon,
i am not sure if "send" will do here!
Fact is, you cannot get "in between" a visual effect, everything ALWAYS halts during this takes place!
Means you can only take action BEFORE or AFTER the visual effect!
And I am still not sure, what exactly you want to do.
Could you explain in pseudo-code?
Best
Klaus
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 6:54 pm
by jon
Hi Klaus
I will try
Btn 1
on mouseUp
Show image 1
Move image 1 from this loc to that loc
Hide image 1 with viseffect dissolve
end mouseUp
Btn 2
on mouseUp
Show image 1
Move image 1 from this loc to that loc
Hide image 1 with viseffect dissolve
end mouseUp
The above but with up to 6 btns
I need to be allowed to click each Btn one after the other while the graphics are still moving
Without any (or at least no noticable delay ) to clicking each btn
Hope that makes sense, can this be done
Many thanks, Jon
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 9:20 pm
by jmburnod
Hi Jon,
This script do what you have described on pseudo code
Code: Select all
on mouseUp
put the loc of the target into tlocS --•• the start Loc
set the loc of image 1 to tlocS
put tlocS into tLocD
add 150 to item 1 of tlocD --•• the dest Loc
lock screen for visual effect
Show image 1
unlock screen with visual effect dissolve
Move image 1 from tlocS to tlocD in 1000 milliseconds
lock screen for visual effect
Hide image 1
unlock screen with visual effect dissolve
end mouseUp
Best regards
Jean-Marc
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 10:14 pm
by jon
Thanks Jean-Marc
I will get on to that in the morning and let you know how it goes.
I can see that your code looks good and will work but I am not certain if that's what I need, hopefully though this will solve my problem.
Even if it's not what I need for this problem, I have learnt another way of doing "things"
Thanks again, I don't think I could progress very much without you guys, my brain is going into melt down with age I think.

Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 10:33 pm
by jon
Hi Jean-Marc
I just couldn't wait for morning, I implemented your code and I am very pleased to say it is about the nearest I will get to what i need, and I am very satisfied with the result.
Thank you so much Jean-Marc (and Klaus )
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 11:05 pm
by dunbarx
Hi.
I am now not sure what you wanted, since you were OK with Jean-Marc's code. I thought you wanted to press multiple buttons, each moving an image from one loc to another.
The following still has issues, but is it closer to your original query?
I made three buttons, and in each made a custom property called "startLoc", which contains a starting loc, like 100,100, and also set another property, "endLoc", also with some valid loc.
In each of the buttons, place:
Code: Select all
on mouseup
send "moveImage" && quote & the startloc of me & quote & "," & quote & the endLoc of me & quote to this card in 0 millisec
end mouseup
In the card script, place:
Code: Select all
on moveImage startloc,endLoc
Show image 1
Move image 1 from startloc to endLoc in 100 ticks
Hide image 1 with viseffect dissolve
end moveImage
Pressing a button will run the image, and pressing another will wrest control and do its own thing. Is this what you wanted? Or did you want all of many possible button presses to queue and run consecutively?
Craig Newman
Re: send me to tNutHouse in 500 milliseconds
Posted: Sun Aug 19, 2012 11:20 pm
by jon
Hi Craig
Thanks for the reply, the code you have is roughly what I was doing before, but you are correct, I want each "thing" to run consecutively, thank you very much for trying to help me, you give me the confidence to carry on because you don't worry about my inexperience. ( and doziness )
Thanks again Craig
Re: send me to tNutHouse in 500 milliseconds
Posted: Mon Aug 20, 2012 5:49 am
by dunbarx
One day you will be a mentor for others.
OK
Make one field. Make one image.
Make four buttons. In each place:
Code: Select all
on mouseup
if fld 1 = "" then
put the startloc of me && the endLoc of me & return after fld 1
send "moveImage" to this card
else
put the startloc of me && the endLoc of me & return after fld 1
end if
end mouseup
In the card script:
Code: Select all
on moveImage
repeat until fld 1 = ""
move image 1 from word 1 of fld 1 to word 2 of fld 1 in 200 ticks
delete line 1 of fld 1
end repeat
end moveImage
I created two custom properties in each button, "startLoc" and "endLoc" I put values into these so that the endLoc of btn 1 was the startLoc of btn 2. And so forth. I had:
button 1: startLoc = 100,100. EndLoc = 100,200
button 2: startLoc = 100,200. EndLoc = 200,200
button 3: startLoc = 200,200. EndLoc = 200,100
button 4: startLoc = 200,100. EndLoc = 100,100
You can press the buttons all day. The field will load with locs, and if you press the buttons in order, 1/2/3/4..., the image will track a square for as long as you care to watch. I used a field to show the queue of locs. The card runs through these, deleting the set just run, until there is nowhere else to go. Still not sure this is what you intended, but it was fun to make. The whole thing can be tightened in several places, and you can always use a custom property to hold the queue instead of a field. The dissolving thing I leave to you.
Craig Newman
Re: send me to tNutHouse in 500 milliseconds
Posted: Mon Aug 20, 2012 2:30 pm
by jon
Hey thanks Craig
That looks very interesting, I'll learn something playing about with that, it definately looks like some basis to add to my game code, now or in the future. I'm going to save that with your comments.
thanks for the time you've taken to help me out
