So I am starting up my “globability.org” work again and need a quick little project to regain the feeling of traction again.
Some of you know the hard struggle that came down on The Global Ability Intitative, with “Russian” hackers trying to destroy our work by redirecting to… yah you know crapware n'stuff, as well as some SEO optimizing arseholes who had a stab at both my personal domain, as well as that of The Global Ability Initiative…. What a world eh?
Anyway I have decided to see how quickly I can make a rough POC for the small application on the suggestion page at http://globability.org/wiki/doku.php?id=symbol_training the application is the one called NO #2 on the sketch. I will be snatching some of my variable names and the concept for this POC. Don't know how fast I can be with work and Chinese New Year sneaking up on me but let's see what we can get ourselves into and hopefully out off again :)
While I have never tried the LiveCode environment I figured I'll give it a try, as the promise of an easy to use cross platform application development framework that people are working on GPL'ing Kickstarter here is a great lure and being able to write once deploy to many platforms simultaneously, is something that I can't really stand for and why not try to chronicle my efforts as well so that others can learn.
If you want to follow my progress and tag along (and eventually speed ahead… probably sooner rather than later) you can download the Livecode development environment at http://runrev.com/ in a 60 day free trial and create applications for Android, Linux, Apple IOS, Windows… though the trial is limited to one deployment OS at this time. Hope they'll change that.
The User Reference manual is here.
I also suggest you support the Kickstarter project they have going on if you have money or even the fact that you mention them is great stuff as well!
I have made my pledge and truly hope that my chronicling can result in something good as well. Both for The Global Ability Initiative as well as for the LiveCode GPL project…
Mind you that while I am using Day 1, 2, 3, 4 etc. does not imply full working days, but is merely an indication of what day I have worked of the 60 day trial period. I'll try to add some sort of time indication under every day.
Also notice there is no consistency in the use of we I and you… because… well there just isn't as I have been writing this as kind of a personal diary, while at the same time am working on preparing the text to be used for a tutorial in a more refined form… sorry if you are a grammar freak this one will have you sleepless and then some :)
At the end of the experiment I will be putting this into a nicer and more consistent form and clean up comments and code to the extent I deem needed for using the POC for something educational.
Creating a draggable button
Import as control
(choose image to import)
plonk image on screen
Select object - edit script
on mouseDown grab target end mouseDown
Then to give our draggable button a name… “circle” - how innovative :)
Time to figure out 5-10 minutes
Then onto collission detection as I thought this would be the proper way to do the testing
Spent a lot of time trying to get image location… however to no avail.
Time spent couple of hours…. good thing I cut my hair and shaved, or I'd be pulling it out with roots :)
So we have a cirle that can be moved, but what to do about the darn position…. Wonder if there might be a mouse position somewhere that could be used…
And Yup, Bingo !!!
Created a function called positionOfMouse() and decided to feed the results into a textfield (for demonstration purposes) on the main UI
And just to see that there is a change well when the button is released add a mouseup that overwrites the value - Eventually one could put this type of stuff into a loop that excutes continiously if one wants to check position all the time. (could be if you wanted to create a drawing (freehand) function or whatever…
We shall however likely be using the mouseUp for some sort of colission / boolean truth check
But like I said I am not too familiar with the environment so all this is going to be very crude.
But here's our button control object, that can now tell us where the mouse cursor was at when grabbed and delete everything when we release it again :)
on mouseDown
grab target
get positionOfMouse()
put the result into field "xCoord"
end mouseDown
on mouseUp
put "finito" into field "xCoord"
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
Hooray - a draggable button that tells us where it is! And then hurries to erase every trace….. but not for long
Now we add another thing to the circle mouseUp and remove our “finito thing” so the circle button looks like this:
on mouseDown
grab target
get positionOfMouse()
put the result into field "xyCoordStart"
end mouseDown
on mouseUp
get positionOfMouse()
put the result into field "xyCoordEnd"
--- do a loc check if = hole coordinates so hooray answer
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
Now we add another element - the hole to where we wish our circle to be draggable to, and imaginative as we are we call this element holeWe lock the position (right click on image - select lock position)Now by using what our program already does we can determine if location is roughly within following x,x-y,y coordinates we can accept that we have pulled the circle to the hole and the answer is correct.So pull the circle around and find an acceptible zone and write down your findings.The coordinates I'm choosing are as follow: 60.90-40,70Now we need to look at our mouseUPwe need to use the coordinates we are posting into the textfield within an if structure to determine if we are in the correct position.
Chinese new year today - Do not expect much activity today :) Xin Nian Kuai Le - May you all live long and prosper ! ;)
Upcoming plan is creating a location check akin to this pseudocode_
if
(value leftmost,topmost> currentmouselocation < rightmost, topmost & value leftmost,bottom > currentmouselocation < rightmost, bottom ) then
answer answerText
end if
TODO make a stackcard with global variable and mechanism to display a particular answerbox that can be called from anywhere
put “placement for object circle is in the hole hooray” in answerText and then have different answerboxes on that stack card to keep functionality of code as simple and modular as possible.
This is what I ended up with:
on mouseDown
grab target
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 500 millisecs with messages
---- the 500 ms wait is introduced based on fears of system hanging according to LiveCode
----discussion on cochlear implant assistive program and mouse clicks akin to our old T-Board project
end repeat
end mouseDown
on mouseUp
And Bingo - We have a continuous check on where our mouse cursor is.
In order to let us track what object is selected we create a local variable truthCheck
For now it is a boolean that is set to true when we grab the object, I have included some code that shows it's value on screen etc.
Later we will change this to a unique object identifier… could be Circle = 1, Square = 2, Triangle = 3
We also need to read out the values of the mouseLoc into a format where we can pull out info and perform som simple math in order to find if we are in the right location - The below snippet is where I'm and if you're still with me, we are at right now. (start typing) - But first, remember when developing SAVE SAVE SAVE and preferably in incrementally numbered files with some common prefix, that way you can roll back - When I get older I might start using some versioning system ;)
local truthCheck
on mouseDown
grab target
get setTruth()
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks akin to our old T-Board project
end repeat
end mouseDown
on mouseUp
get checkTruthValue()
put the result into field "xyCoordEnd"
get positionOfMouse()
put item 1 of the mouseLoc into currentMouseLoc[1]
put item 2 of the mouseLoc into currentMouseLoc[2]
--- do a location check plus see if correct shape is selected - if = hole coordinates correct and shape is right so hooray answer else nothing
---we will need to put the mouseLoc into a local variable currentMouseLoc and check against values of leftmostTopMost and rightMostBottom
---these represent the top and leftmost position of our hole as well as the lowest and rightmost and bottom position of our hole
--if (60.90) > current mouseLoc() < mouseLoc(40,70) ) & true is in truthCheck then -- value leftmost,topmost> currentmouselocation
----< rightmost, topmost & value leftmost,bottom > currentmouselocation < rightmost, bottom ) and the correct shape is selected -> then
if (true is in truthCheck ) then
put currentMouseLoc[1] into field "currentXPos"
put currentMouseLoc[2] into field "currentYPos"
--answer answerLoc
else
end if
---- instead of answer we can trigger some other behaviour from our program - like counting points etc....
--end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put true into truthCheck
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
And finally after some trial and error it is now possible to determine if we have placed the circle in the correct spot by reading the loacation of the draggable button and comparing it to something similar to the values we determined on day 2 of our little experiment. The code below will now be modified regarding the truth check so that we can determine if the circle has been detected we will create a function called selectedItem or similar, we will give the item a number. Once we know this also works we will proceed to create a truthcheck,
I think we might as well try and create this on a card by itself or onto the main card so as to begin separating logical functions out of the button and creating a general purpose truthcheck to determine if selected buttons / items are correct.
local truthCheck
on mouseDown
grab target
get setTruth()
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks akin to our old T-Board project
end repeat
end mouseDown
on mouseUp
get checkTruthValue()
put the result into field "xyCoordEnd"
get positionOfMouse()
put item 1 of the mouseLoc into currentMouseLoc[1]
put item 2 of the mouseLoc into currentMouseLoc[2]
put item 1 currentMouseLoc[1] into currentMouseLocXVal
put item 2 of the mouseLoc into currentMouseLocYVal
--- do a location check plus see if correct shape is selected - if = hole coordinates correct and shape is right so hooray answer else nothing
---we will need to put the mouseLoc into a local variable currentMouseLoc and check against values of leftmostTopMost and rightMostBottom
---these represent the top and leftmost position of our hole as well as the lowest and rightmost and bottom position of our hole
--if (60.90) > current mouseLoc() < mouseLoc(40,70) ) & true is in truthCheck then -- value leftmost,topmost> currentmouselocation
----< rightmost, topmost & value leftmost,bottom > currentmouselocation < rightmost, bottom ) and the correct shape is selected -> then
if (true is in truthCheck and currentMouseLocXVal >= 50 and currentMouseLocXVal <= 100 and currentMouseLocYVal >=40 and currentMouseLocYVal <=60) then
put currentMouseLoc[1] into field "currentXPos"
put currentMouseLoc[2] into field "currentYPos"
answer "You put the circle in the correct spot - Congratulations!!!"
else
put "Not there yet" into field gettingWarmer
wait 50
put "" into field gettingWarmer
put currentMouseLoc[1] into field "currentXPos"
put currentMouseLoc[2] into field "currentYPos"
end if
---- instead of answer we can trigger some other behaviour from our program - like counting points etc....
--end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put true into truthCheck
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
Time spent stumbling about 3-4 hrs… and finally I found the user reference as well :) My big problem is that it is too simple to get values from variables into other variables… not used to such simplicity - really hard to get used to not having to jump around hoops… he he
Today we're going to try and work a little smart. We'll have all the buttons figure out and tell us where on screen they are. This way we'll be able to re-use code even is screen is resized, stuff is moved about etc.
After all it could be a hole would attempt to run away while you tried to catch it ;)
In our hole script our hole should tell a location tracker variable where it is.
In time code will be changed to have an accessor function in the hole object and a general movement tracker polling hole accessor or whatever object we want to track, for it's location on screen, thus removing activity from the general object behaviour, only to be triggered if asked politely :) thus, reducing the number of CPU cycles expended on our hole just to exist.
For now we'll do an update of a global variable we get from the hole that is set and red when we click on the circle and release it after we move it about, in the future we'll have a location tracker controller poll for this information rather than polling the hole itself.
global cHoleButtonCoordinates
on mouseDown
grab target
end mouseDown
on mouseUp
---put item 1 of location of img hole into circleHoleButtonCoordinates
get whereAmI()
get hereAmI()
end mouseUp
function whereAmI
put the location of image "bighole" into circleHoleButtonCoordinates
put item 1 of circleHoleButtonCoordinates into cHoleButtonCoordinates[1]
put item 2 of circleHoleButtonCoordinates into cHoleButtonCoordinates[2]
return whereAm
end whereAmI
function hereAmI
put cHoleButtonCoordinates[1] into field circleHoleButtonField
put cHoleButtonCoordinates[2] into field circleHoleButtonField2
return hereAm
end hereAmI
-- declare variable used for truthcheck
--declaring the cHoleButtonCoordinates
global cHoleButtonCoordinates
global truthCheck
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
---put item 1 of location of img hole into circleHoleButtonCoordinates
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
get checkTruthValue()
put the result into field "xyCoordEnd"
get positionOfMouse()
put item 1 of the mouseLoc into currentMouseLoc[1]
put item 2 of the mouseLoc into currentMouseLoc[2]
put item 1 currentMouseLoc[1] into currentMouseLocXVal
put item 2 of the mouseLoc into currentMouseLocYVal
get whereIsHole()
--- do a location check plus see if correct shape is selected - if = hole coordinates correct and shape is right so hooray answer else nothing
-
if (truthCheck = 1 and (cHoleButtonCoordinates[1] <= currentMouseLocXVal and currentMouseLocXVal <= cHoleButtonCoordinates[1]+32 ) and (cHoleButtonCoordinates[2] <= currentMouseLocYVal and currentMouseLocYVal <= cHoleButtonCoordinates[2]+32) ) then
--location (loc): The location of an object is specified as the X,Y coordinates of the center of the object in reference to the upper left-hand corner.
--You change the location of an object by setting its location property in an x,y format.
put currentMouseLoc[1] into field "currentXPos"
put currentMouseLoc[2] into field "currentYPos"
answer "You put the circle in the correct spot - Congratulations!!!"
else
put "Not there yet" into field gettingWarmer
wait 50
put "" into field gettingWarmer
put currentMouseLoc[1] into field "currentXPos"
put currentMouseLoc[2] into field "currentYPos"
end if
---- instead of answer we can trigger some other behaviour from our program - like counting points etc....
--end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "1" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1, need to rename to something more meaningful
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function whereIsHole
put the location of image "bighole" into circleHoleButtonCoordinates
put item 1 of circleHoleButtonCoordinates into cHoleButtonCoordinates[1]
put item 2 of circleHoleButtonCoordinates into cHoleButtonCoordinates[2]
return whereIs
end whereIsHole
Fiddling on and off today… 4 - 5 hrs…. going to stop because I know I'm doing the position check wrong but too tired to see what I am not doing correct, will need to break down the whole if/and structure…. wish I could say if value of X between X1 and X2 and value of Y between Y1 and Y2 then…. in a simpler way… think I am close though…
Celebrating 5'th year wedding anniversary so won't touch anything today…
Been messing about with the location check - nearly there but having guests over, so now… vacuming - Found some funny uses for img intersect by the way - imagine small pixels hitting an object = kaboom ;) groovy… yeah you figure out the rest… unless I eventually get to it :)
-- declare variable used for truthcheck
--declaring the cHoleButtonCoordinates
global cHoleButtonCoordinates
global cButtonCoordinates
global truthCheck
local count = 0
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
get inTheRightPlace()
put cHoleButtonCoordinates[1] into field "obj2FieldXPosition"
put cHoleButtonCoordinates[2] into field "obj2FieldYPosition"
---move image "circle" to 200,100
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
get inTheRightPlace()
put cButtonCoordinates[1] into field "obj1FieldXPosition"
put cButtonCoordinates[2] into field "obj1FieldYPosition"
wait 25
put "" into field "xyCoordEnd"
get positionOfMouse()
--put item 1 of the mouseLoc into currentMouseLoc[1]
put cHoleButtonCoordinates[1] into field "obj2FieldXPosition"
put cHoleButtonCoordinates[2] into field "obj2FieldYPosition"
--put item 2 of the mouseLoc into currentMouseLoc[2]
--put item 1 currentMouseLoc[1] into currentMouseLocXVal
--put item 2 of the mouseLoc into currentMouseLocYVal
--move image "circle" tostart position again
--move image "circle" to 150,100
--- do a location check plus see if correct shape is selected - if = hole coordinates correct and shape is right so hooray answer else nothing
--put "Not there yet" into field insideIndicator
get whereIsCircle()
-- if (truthCheck = 1 and (currentMouseLoc[1] >= cHoleButtonCoordinates[1] and currentMouseLoc[1] <= cHoleButtonCoordinates[1] +34 and currentMouseLoc[2] >= cHoleButtonCoordinates[2] and currentMouseLoc[2] <= cHoleButtonCoordinates[2]+32 ) ) then
if "circle selected" is in truthCheck then -- and ( cButtonCoordinates[1] >= cHoleButtonCoordinates[1] ) then -- and cButtonCoordinates[1] <= cHoleButtonCoordinates[1] +34 and cButtonCoordinates[2] >= cHoleButtonCoordinates[2] and cButtonCoordinates[2] <= cHoleButtonCoordinates[2] +32 ) then
--location (loc): The location of an object is specified as the X,Y coordinates of the center of the object in reference to the upper left-hand corner.
--You change the location of an object by setting its location property in an x,y format.
put cButtonCoordinates[1] into field "currentXPos"
put cButtonCoordinates[2] into field "currentYPos"
put "You put the circle in the correct spot - Congratulations!!!" into field insideIndicator
else
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "circle selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsHole()
get whereIsCircle()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
function whereIsHole
put the location of image "bighole" into circleHoleButtonCoordinates
put item 1 of circleHoleButtonCoordinates into cHoleButtonCoordinates[1]
put item 2 of circleHoleButtonCoordinates into cHoleButtonCoordinates[2]
return whereIsTheHole
end whereIsHole
function whereIsCircle
put the location of image "circle"into circleButtonCoordinates
--
put item 1 of circleButtonCoordinates into cButtonCoordinates[1]
put item 2 of circleButtonCoordinates into cButtonCoordinates[2]
return whereIsTheCircle
end whereIsCircle
As you can see I've tried to structure the code towards something more universally usable all while fighting to get the darn values for the circle button…. Just found out I forgot to declare the variable I wanted to access… AAAAAAARGH!!!
Anyway I can finally get the values for both the stationary button as well as our movable control button, meaning collision detection based on location should work properly tomorrow or so…. also need to clean up the script but just pasting it as is for safekeeping off local site… boy I wasted a lot of time forgetting that declaration… LiveCode needs a function that automatically declares variables or maybe a (do you want to create local/global) when you type up something…
Anyway, going to hit the sack now - Happy I finally tracked this one down… sometimes I guess a good meal, the company of good friends and not least ones sweet wife is the cure when you're in a rut and feeling stuck….
So here's the plan. As this is a program aimed at testing dexterity and training dexterity as well as ability to use logic to distinguish between shapes etc. we'll begin with the big hole and making colission detection work within fixed parameters, after we have proven colission detection to work for placing the circle within bighole we can replace the fixed numbers with a variable called marginX and MarginY, these in term need to be accessible and changeable through a function.
By introducing marginX and marginY we add both precision to our colission detection as well as the ability to move about our focus for colission detection, meaning we can reuse the routine for any object and focus on collission detection in different places.
A simple explanation imagine the below is an image, for the sake of argument it has been subdivided into squares. In the grid you'll see the letters C T O I X
|------------------------ | C | | | | | T | ------------------------- | | | O | | | | ------------------------- | I | | | | | X | -------------------------
Yup you guessed it T O X I C, as in the situation you can land in if you collide with a chemical truck or something equally nasty…
Each letter you see represents a point where either X or Y coordinates differ…
C would represent an exact match in the topmost corner, O would be a representation of right smack in the middle, while the others represent their own respective corner, but you can imagine the letters moving about to other boxes, only in reality the margin of precicion with which you can eventually set your collission detection is down to 1 pixel which I'd dare say is pretty good accuracy.
Okay now to work!
We know the dimensions of the bigcircle image to be 78hx76w - You can figure out sizes of images by right clicking, choosing the property inspector and then select size and position easy peasy, you can probably also read this in your favorite drawing program before you import any images.
We also figured out how to get the respective locations for our circle and our bighole objects, these locations are saved in two arrays for ease of access and understandability.
These are called cHoleButtonCoordinates and cButtonCoordinates
At a later time we could change these into general location indication variables that can be reused in a location tracking structure that can then be used for tracking all objects on screen.
But for now we'll do it the non general way so that you get an idea of what is going on.
But first a summary:
Size of bighole 78hx76w
Size of circle 32hx32w (it was originally sized according to the size of a mouse cursor as it was supposed to be used in a sneaky little java manouver, but I never finished the java program, nor the HyperText Markup Language HTML stuff as I got severely sidetracked by some nice crackers who almost brought my work on my persomnal page as well as the work on The Global Ability Initiative to a stand still…. anyhow back to colission detection.
cHoleButtonCoordinates holds the coordinates for the bighole
cButtonCoordinates holds the coordinates for the circle
We want to claim a success if we manage to place the circle within the bighole so let us do a do a location check plus see if correct shape is selected.
The first part of our if structure will be the easy part
if (truthCheck = 1
truthCheck is a variable that is set using the setTruth() function
In setTruth() a variable called truthCheck is set to 1 - The use of numerical variables enables us to distingush between the precise object that is selected rather that just checking if something is selected, by knowing what object is selected we also know that if we (when we extend the program) put the square on the circle there is no match and thus the trainee has not placed the object correctly.
If we had no interest in the exact nature we could have used a boolean operator true / false to distinguish if something was selected and if true then we could do what we wanted to do. (This is handy to keep in mind if you ever need to set a simple condition like switchFlicked (true/false) )
Objects in LiveCode are defined positionwise by topmost,leftmost coordinates so we want to check the coordinates of the circle first against the topmost leftmost coordinates of bighole.
We do this by comparing the values held within the arrays against each other.
Establish that the circle is placed as a minumum at the same x,y coordinates as the topmost leftmost coordinates of the bighole
We do however also need to make sure that the circle is within the rightmost side of the hole, so as a minimum the rightmost part of the circle needs to be within bighole.
We want the topmost part of bighole being equal to or lower than topmost part of circle and lowest part lower than circle.
And this is what we end up with
( cButtonCoordinates[1] >= cHoleButtonCoordinates[1] -32 and cHoleButtonCoordinates[1] + 44 >= cButtonCoordinates[1] and cHoleButtonCoordinates[2] ⇐ cButtonCoordinates[2] +32 and cHoleButtonCoordinates[2] +32 >= cButtonCoordinates[2] ) then
We will add an else so that we can go in a different direction if our collission detection is not okay
At a later stage we'll add the xMargin and yMargin we talked about so that we can make our colission detection more variable.
As also mentioned yesterday some cleaning up is needed and the following is the somewhat cleaned up circle script - we can proceed next time to move the collission detection to on mouseDown making the detection dynamic rather than the fait accompli type we have below at the moment, this way we could create a collission warning etc. rather than an… oops sorry you collided :)
-- declare variable used for truthcheck
--declaring the cHoleButtonCoordinates
global cHoleButtonCoordinates
global cButtonCoordinates
global truthCheck
local count = 0
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put cButtonCoordinates[1] into field "obj1FieldXPosition"
put cButtonCoordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put cHoleButtonCoordinates[1] into field "obj2FieldXPosition"
put cHoleButtonCoordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( cButtonCoordinates[1] >= cHoleButtonCoordinates[1] -32 and cHoleButtonCoordinates[1] + 44 >= cButtonCoordinates[1] and cHoleButtonCoordinates[2] <= cButtonCoordinates[2] +32 and cHoleButtonCoordinates[2] +32 >= cButtonCoordinates[2] ) then
put "You put the circle in the correct spot - Congratulations!!!" into field insideIndicator
else
--This is a simple message that we are not successfull it could however be something else like triggering a function
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "circle selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsHole()
get whereIsCircle()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
function whereIsHole
put the location of image "bighole" into circleHoleButtonCoordinates
put item 1 of circleHoleButtonCoordinates into cHoleButtonCoordinates[1]
put item 2 of circleHoleButtonCoordinates into cHoleButtonCoordinates[2]
return whereIsTheHole
end whereIsHole
function whereIsCircle
put the location of image "circle"into circleButtonCoordinates
--
put item 1 of circleButtonCoordinates into cButtonCoordinates[1]
put item 2 of circleButtonCoordinates into cButtonCoordinates[2]
return whereIsTheCircle
end whereIsCircle
Day 9
Will probably do no coding today, have written to people within
my company suggesting them to pledge, made a post on our
intranet about livecode and the dignitaries that have pledged
and will be making a couple of postings on a couple of forums I
frequent from time to time.
I've also been doing a little doodling with my graphics program
creating some big holes of different shapes to be used for our
next step having multiple shapes to choose from :)
Day 10
So I was thinking about how to keep track of score, time etc.
for our game and I had an idea of a scorecard in my head
If you can imagine a structure/class that is intended as a kind
of stats module
I was thinking it would hold a number of Dynamically settable
values needed for all things counters
–Different Stat Counters
global rightAnswers function addRightAnswer
global wrongAnswers function addWrongAnswer
global addNumber function addNumber
totalPoints function addPoints
–For timekeeping I was thinking of create a couple of variables
startTime
endTime
While called points in a game the points may be currency, health
or whatever, it is up to you to use the points controller for
your game to decide exactly how to use this, truth be told it
would be even better creating a construct of a datastructure
that simply allowed you to put in whatever name and variable
into the structure
and then adding or changing values for the datatypes in said
structure
But as we are trying to approach this in an object oriented way
- which of the above sound like more of the same ?
I'd say that the following four could easily be put into the one
and the same type of variable and use the same globally callable
routine to be updated, in reality the terms would more correctly
be used as parameters for the function in order for them to be
placed within the correct datastructures.
rightAnswers, wrongAnswers, addNumber, totalPoints
For instance the rightAnswers variable is a number from 0 to
infinity, I'm hoping the LiveCode environment as mentioned
elsewhere on the web truly will be taking care of this as it
will be the premise for the structure I would like to create.
The same goes for the other values mentioned. They are all
numbers but we give them different meaning in different context,
but they are merely data.
So I'd like to introduce something called metaExplanation and
uniqueIdentifier.
The latter might be irrelevant as it is not unthinkable LiveCode
already has a way of doing this, but for us puny humans to make
heads or tails of what's going on let us keep it at least for
now.
Imagine a data structure consisting of objects of different
kind, we will begin with our scorecard variables but it is not
unthinkable we can add to the values herein or create similar
structures for similar purposes.
So what we need are functions to add said objects to specific
slots in our datastructure and we need functions to manipulate
the objects as well.
But let us define a rough datastructure and then proceed to
create the functions to create the objects and then the
functions to manipulate values of said objects.
|--------------------------------------------------
|uniqueIdentifier | metaExplanation | object|
---------------------------------------------------
The metaExplanation object is a description holding valuable
information about what type of objects are stored within the
particular slot of our datastructure.
It holds a description of variables within said object, accessor
methods and purpose of the related object.
The reason for not containing this information within the object
itself, is that in many cases, for computational purposes this
is redundant information and would potentiall increase the size
of our objects considerably.
The metaExplanation obect consists of the following information
[uniqueIdentifier|metaExplanation|object type|variable
names|accessor methods]
For future reference it should be possible to read this data out
of the objects automatically, but for now the values will be
added manually once we get that far.
It might also be prudent for dealing with more complex objects,
to split up into two tables, so that the metaExplanation is
exchanged with a number (in case of multiple objects in table
with same “abilities”)
And that we then created a metaExplanationDataObject holding all
the different metaExplanations numbering them from 1 to infinity
for identification purposes.
That way we would know exactly (in human readable form) what
type of object we were dealing with etc.
This might seem overkill but I believe being able to see things
in human readable form, while working on a project is of great
benefit for our understanding, even though we might remove such
functionality from our finished product.
timeToSolve is another useful variable for us, we will use this
variable to store a slew of answertimes
– For each object in game to solve
put “Time used to solve”,“Puzzlename”,“Level”,
“YY”,“MM”,“WW”,“DD”,“HH”,“MM”,“SS” into timeToSolve, the format
for the object timeToSolve is “Puzzlename”, ““Years”, “Months”,
“Weeks”, “Days”, “Hours”, “Minutes”, “Seconds”
put “Number of wrong answers:”,”0“ into wrongAnswers
put “Number of right answers:”,”0“ into rightAnswers
put “0” into addNumber
put “0” into totalPoints – Will we not do anything about this
variable in this instance as our game at the moments is not
points based
put “0,0” into totalPercentage
We will need getters and setters for the values of each variable
in our datastructure object.
wrongAnswers, rightAnswers totalPoints can all be affected by
our addNumber variable, addNumber can be affected from the
outside individually as well, this way we can reuse the
addNumber variable for multiple purposes whenever we need to add
an integer to something. We shall be concentrating on the
integers in this project I have merely added totalPercentage as
an indicator that you might need a percentage at some point,
could for instance be Health, or ownership or something similar
you'd like to type out in percentages.
addNumber - we will deal with by itself.
startTime/endTime - are also something we'll look at later
perhaps creating a time object that can hold all the information
we desire.
But let us begin by creating the scorecard, right click on your
main stack that you created, choose add card,
Right click on the newly created card, choose card property
inspector - give the card the name scorecard
Let's look at creating some functions like addNumber and one to
set both wrongAnswers, rightAnswers as well as totalPoints,
leaving totalPercentage for a later time.
Preliminary code for scorecard
Here's the preliminary code for scorecard - I have not tested
the code yet, one way to test would be creating a button to add
a specific value and another to add values based on something
you put into a text input box, notice our functions now take
parameters, that means we can pass for instance identification
numbers and such to our functions thus determining different
behaviour dependent upon what values we pass to them, pretty
neat eh ?
--This card will hold a range of functions needed in order to keep scores etc. in a game or program where score keeping is needed
--Long term objective, create a datastructure to hold all the different values we create here and accessor methods for them
global numberToAdd
global answersIdentifier
local addThis
--the format for the object timeToSolve is "Puzzlename", ""Years", "Months", "Weeks", "Days", "Hours", "Minutes", "Seconds"
--this object is used to keep track of how long it took to solve a particular puzzle
put "Time used to solve","Puzzlename","Level", "YY","MM","WW","DD","HH","MM","SS" into timeToSolve
--Keeping track of wrong answers
put "Number of wrong answers:","0" into wrongAnswers
--Keeping track of right answers
put "Number of right answers:","0" into rightAnswers
--Keeping track of points we will not do anything about this variable in this instance of our scorecard, as our game at the moments is not points based
put "0" into totalPoints
--Keeping track of percentages we will not do anything further about this variable in this instance of our scorecard, as nothing in our
--game at the moments is percentage based
put "0,0" into totalPercentage
-- addNumber is used for adding arbirtary integer numbers to the different tallies we use within this card, this setter should be globally accessible
-- as should the numberToAdd integer
function addNumber numberToAdd
put numberToAdd into addThis
return addThis
end addNumber
--The function addNumberTo() is used for adding value to one of 3 different tally holders - wrongAnswers - rightAnswers - totalPoints
-- the function addNumberTo() - takes two parameters answersIdentifier addThis
-- answersIdentifier identifies which tally holder we wish to update
-- addThis is the value we wish to add to our tally, this value is set using the addNumber function
function addNumberTo answersIdentifier addThis
if "1" is in answersIdentifier then
--wrongAnswers
put addThis + wrongAnswers into wrongAnswers
--Possible do something to wrongAnswers - like updating the datastructure unless it is already updated by us setting the value here... *
return wrongAnswers
else if answersIdentifier=2 then
-- rightAnswers
put addThis + rightAnswers into rightAnswers
--Possible do something to rightAnswers - like updating the datastructure unless it is already updated by us setting the value here... *
return rightAnswers
else if answersIdentifier=3 then
--totalPoints
put addThis + totalPoints into totalPoints
--Possible do something to totalPoints - like updating the datastructure unless it is already updated by us setting the value here... *
return totalPoints
end if
end addNumberTo
– * Notice datastructure not yet created - and the use of
objects is wrong, should be variables as we are creating a
dataobkject to hold information about objects in our program not
an object to hold objects - And as LiveCode is not As far as I know AFAI truly object oriented it
will be a datastructure rather than an object containing
different variables.
Day 11 & 12
Have not had much time to code, been working sunday evening and
night to monday (bread and butter stuff) and after work today
(more bread and butter stuff) I've been messing with testing my
new 4G USB modem. Want to free myself of the cable provider for
internet access as I only use the cable for this functionality
and can save more than 60% by switching to mobile connectivity…
I estimate having only used minutes to actually playing around
with the coding environment.
Anyway here are some further thoughts on getting a value from
one card to another beginning with transferring information from
a button script to a card function.
global numberToAdd
on mouseUp
put "1" into numberToAdd
--As a test of passing variables from a script into another card we have first created a button and a text field on the scorecard
--We will then try to have the script on the scorecard do the math and display the results on the scorecard, next step will be moving the button to another card
--and then see if we can still manipulate values on said card
get addNumber(numberToAdd)
put the result into field "numbertoadd"
end mouseUp
And code something like this on scorecard
global numberToAdd
function addNumber numberToAdd
local addThis
put numberToAdd into addThis
--to prove somehing is actually taking place in this function we add a value to the local variable that is returned
put 1+ addThis into addThis
--Just to see it is happening look at button functionality (displaying processed value) - Will be replaced with other functionality
return addThis
end addNumber
Notice we are taking the global variable from the button -
feeding it to the function on scorecard, processing it and then
displaying it from the button
Day 13
This is how a working model of our function looks like
global numberToAdd
/* Testing if you just put function in top script it is available in all cards below - But this makes for messy coding, how to put the function in one card and
call it from another ???
The Global variable numberToAdd is to be used as a parameter for adding arbirtary integer numbers to different tallies used within the scorecard, this parameter setter should be globally accessible
this we can by decalring the global numberToAdd in whichever script we need it (top of card script is a good place to declare) while this is currently achievable so should the function numberToAdd and that is the conundrum to solve*/
function addNumber numberToAdd
put numberToAdd into addThis
--to prove somehing is actually taking place in this function we add a value to the local variable that is returned
put 1+ addThis into addThis
--Just to see it is happening look at button functionality (displaying processed value) - Will be replaced with other functionality
return addThis
end addNumber
if the above function is called like this for instance, from any
card below in the stack
global numberToAdd
global totalCorrect
on mouseUp
put "3" into numberToAdd
--As a test of passing variables from a script into another card we have first created a button and a text field on the scorecard
--We will then try to have the script on the scorecard do the math and display the results on the scorecard, next step will be moving the button to another card
--and then see if we can still manipulate values on said card
get addNumber(numberToAdd)
put the result into totalCorrect
put totalCorrect into field "numbertoadd"
end mouseUp
You will get the result 4 in the field numbertoadd on the card
where we are curently working
So now we have discovered the premise for the structure needed
in order to make a counter that counts up, say points, number of
correct answers etc. what we need now is to see if we can wrench
this functionality into cards below.
But before that let us create a working counter of correct
answers, we will wait with the incorrect ones till we have more
holes to choose from, but a tally counting the number of times
we place the circle in the hole is also a worthwhile pursuit.
In the unfinished code from day 11 & 12 you'll notice som if
else sentences, just for the kick of it I'll try and use a
switch, if that does not work I'll pop right back to ye good
olde if then else…
But first a few timer functions that will be coming in handy at
a later stage.
/* TIMER SCRIPTS the global array object is intended to be used for transport of timing information for different processes we want to keep track off - for each process we wish to track we'll use 1 slot to describe said process, here we might as well use the names of our control objects as we want to keep track of how long it takes to put each of them into it's respective correct slot so the structure will probably be something like [triangle] [timeStart][timeStop][timeUsed] [square] [timeStart][timeStop][timeUsed] etc. the 3 last after the description are not declared as globals in order to make them uneditable from other cards - but will that work.... ?*/
global timeObject
local timeStart
local timeStop
local timeUsed
-- store the current start time
function startTim
put the milliseconds into timeStart
return timeStart
end startTim
function stopTim
put the milliseconds into timeStop
return timeStop
end stopTim
function usedTim
put timeStop - timeStart into timeUsed
return timeUsed
end usedTim
And to thest these 3
Button starttim
on mouseUp
get startTim()
put the result into field "calcfield"
end mouseUp
------------------------------------------------
Button stoptime
on mouseUp
get stopTim()
put the result into field "calcfield2"
end mouseUp
------------------------------------------------
Button usedtime
on mouseUp
get usedTim()
put the result into field "calcfield3"
end mouseUp
Live code will give you the the current time in milliseconds you
can use these different timer functions for all kinds of stuff
as it becomes relevant
Day 14
Yesterday I was yapping about creating one counter before the
other one… sorry no can do, I just created them all ;)
This is the counter code in the main stack - It consists of a so
called switch statement, based on the parameter it is fed
“answersIdentifier” it will perform a number of different
operations by adding a number to our counter objects. Notice in
particular the points part of the function.
function addNumberTo answersIdentifier
switch answersIdentifier
case 1
// wrongAnswers
put wrongAnswers +1 into wrongAnswers
return wrongAnswers
--Possible do something to wrongAnswers - like updating the datastructure unless it is already updated by us setting the value here... *
break
case 2
//- rightAnswers
put rightAnswers +1 into rightAnswers
return rightAnswers
--Possible do something to rightAnswers - like updating the datastructure unless it is already updated by us setting the value here... *
break
case 3
// totalPoints
put totalPoints + 100 into totalPoints
--Possible do something to totalPoints - like updating the datastructure unless it is already updated by us setting the value here... *
return totalPoints
break
case 4
// do other stuff
break
default
// do yet more stuff
put "Sorry, there is no known Identifier, can't make selection of course." into line 1 of field "errormessages"
end switch
Since we cant be sure the above actually works I created a
number of buttons text fields (you'll see them mentioned in the
different “buttons”)
By using different values for “answersIdentifier” in each test
button we can prove that our function does something different
depending on the value we set in the button script.
Our proof lies in the visual representation of the calculations
that goes into the text fields.
/* Button wronganswer
This button is for demonstration purposes of a counter that counts one up every time pushed by using a function named addNumber
*/
on mouseUp
--Putting a number of "wrong" answers into the variable, this code we can now move in below our truth check in case the object chosen is correct
put 1 into answersIdentifier
get addNumberTo (answersIdentifier)
put the result into field "wrongoutput"
end mouseUp
--global rightAnswers
on mouseUp
--Putting a "right" answers into the variable first we choose what variable we want to add to
put 2 into answersIdentifier
--Then we launch the calculation
get addNumberTo (answersIdentifier)
--Then for demonstration purposes we display the counter result in our counter field
put the result into field "rightoutput"
end mouseUp
on mouseUp
--Putting a "right" answers into the variable first we choose what variable we want to add to
put 3 into answersIdentifier
--Then we launch the calculation
get addNumberTo (answersIdentifier)
--Then for demonstration purposes we display the counter result in our counter field
put the result into field "pointsoutput"
end mouseUp
on mouseUp
--Here we purposly set an unknown identifier for our addNumber function
put 5 into answersIdentifier
--Then we ask our function to process
get addNumberTo (answersIdentifier)
wait 200
put "" into field "errormessages"
end mouseUp
By creating a button using a wrong “answersIdentifier” we force
the switch to give it's default response… just to clear the
error dialog box we add the wait and then update the text field
with ”“ i.e. nothing.
We are now ready to add the additional control objects we
created earlier to our LiveCode program, you remember right ?…
my ramblings on the outcome of Day 9… Ah well…
So the status of my LiveCode Experiment on Day 14 is after
managing to squeeze in a few hrs. of programming:
I can do colission detection, I can calculate correct and wrong
answers, I can count points, I can move buttons and images
around, I can do timing.
Basically I think have everything I need in order to proceed to
the next phase which is gluing together the elements I created
creating a trainer for dexterity and logic.
Acknowledged it is not a big application, but I am amazed that I
in the course of a couple of weeks with no prior knowledge and
sparse time on my hands have gotten this far.
I truly hope that RunRev will pull off their Kickstarter which
at the time of writing stands at 1,107 backers having pledged
£149,686 of the £350,000 goal with 7 days to go.
If you have an interest in programming please support the
Kickstarter to Open Source the LiveCode Environment under a GLP3
license.
Day 15
30 minutes of play - result to be posted
Day 16
No coding activity
Day 17
No activity
Day 18
After spending time tending to loved ones, and resting after
quite an ordeal, I have managed to do a minor thing LiveCode
related - I started a Facebook advertisement campaign, :) As in
real ADVERTISEMENTS.
I wanted a simple message something like:
Code in Linux, Mac or Windows, write once.
Deploy to iOS, Android, Linux, Macintosh, Windows, profit ???
Must be expensive...
No FREE if you want it to be!!!
http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode
This is what Iactually ended up with, due to space, punctuation
restriction, a 10 US$ daily budget, 0,41 per click, running from
today to 27'th.
The ad has the following audience:
US - Age 18+
- Broad Categories, Business/Technology: Computer Programming,
Education Teaching, Small Business Owners
Narrow Categories: #Computer programming, #Computer science,
#Source code, #Comment (computer programming), #Porting
In total targetted at 409380 people
The text of the AD
Next Generation LiveCode
Deploy to iOS, Android, Linux, Macintosh, Windows. Expensive? FREE if you want it to be!
http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode
Furthermore I have enable grabbable qualities and set graphical
quality in the property inspector to notScrXor so as to allow
the objects to be shown transparently over the holes without the
background - (transparent png) - probable have to look closer at
graphical qualities but it is working so for now it'll be fine.
I will now proceed to seing if I can get each to respont to
their own hole using the common collission detection routing
created.
In time it is suggested to completely remove the colission
detection from the objects, generalize them even more and
putting them into a library loaded by the main stack, same with
oter functionality developed, but as it is a POC this how it
will be done for now. I'll be adding the code for the other
objects ASAP.
Heptagon
--Heptagon trying to clean up variables
-- declare variable used for truthcheck
--declaring the object2Coordinates
global object2Coordinates
global object1Coordinates
global truthCheck
local count = 0 -- replace with global count
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put object1Coordinates[1] into field "obj1FieldXPosition"
put object1Coordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put object2Coordinates[1] into field "obj2FieldXPosition"
put object2Coordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( object1Coordinates[1] >= object2Coordinates[1] -30 and object2Coordinates[1] + 26 >= object1Coordinates[1] and object2Coordinates[2] <= object1Coordinates[2] +28 and object2Coordinates[2] +22 >= object1Coordinates[2] ) then
--Add switch with right answers here
put "You put the heptagon in the correct spot - Congratulations!!!" into field insideIndicator
/*
circle
square
star
triangle
rectangle
octagon
hexagon
pentagon
heptagon
*/
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "heptagon selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsObject2()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
-- these find functions need to be further generalized so that we just use one function for locating positions of images
function whereIsObject2
put the location of image "bigheptagon" into o2Coordinates
put item 1 of o2Coordinates into object2Coordinates[1]
put item 2 of o2Coordinates into object2Coordinates[2]
return whereIsTheHole
end whereIsObject2
function whereIsObject
put the location of image "heptagon" into o1Coordinates
--
put item 1 of o1Coordinates into object1Coordinates[1]
put item 2 of o1Coordinates into object1Coordinates[2]
return whereIsTheCircle
end whereIsObject
Triangle
--Triangle trying to clean up variables
-- declare variable used for truthcheck
--declaring the object2Coordinates
global object2Coordinates
global object1Coordinates
global truthCheck
local count = 0
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put object1Coordinates[1] into field "obj1FieldXPosition"
put object1Coordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put object2Coordinates[1] into field "obj2FieldXPosition"
put object2Coordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( object1Coordinates[1] >= object2Coordinates[1] -30 and object2Coordinates[1] + 26 >= object1Coordinates[1] and object2Coordinates[2] <= object1Coordinates[2] +28 and object2Coordinates[2] +22 >= object1Coordinates[2] ) then
--Add switch with right answers here
put "You put the triangle in the correct spot - Congratulations!!!" into field insideIndicator
/*
circle
square
star
triangle
rectangle
octagon
hexagon
pentagon
heptagon
*/
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "triangle selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsObject2()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
-- these find functions need to be further generalized so that we just use one function for locating positions of images
function whereIsObject2
put the location of image "bigtriangle" into o2Coordinates
put item 1 of o2Coordinates into object2Coordinates[1]
put item 2 of o2Coordinates into object2Coordinates[2]
return whereIsTheHole
end whereIsObject2
function whereIsObject
put the location of image "triangle"into o1Coordinates
--
put item 1 of o1Coordinates into object1Coordinates[1]
put item 2 of o1Coordinates into object1Coordinates[2]
return whereIsTheCircle
end whereIsObject
Square
--Square trying to clean up variables
-- declare variable used for truthcheck
--declaring the object2Coordinates
global object2Coordinates
global object1Coordinates
global truthCheck
local count = 0 -- replace with global count
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put object1Coordinates[1] into field "obj1FieldXPosition"
put object1Coordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put object2Coordinates[1] into field "obj2FieldXPosition"
put object2Coordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( object1Coordinates[1] >= object2Coordinates[1] -30 and object2Coordinates[1] + 26 >= object1Coordinates[1] and object2Coordinates[2] <= object1Coordinates[2] +28 and object2Coordinates[2] +22 >= object1Coordinates[2] ) then
--Add switch with right answers here
put "You put the square in the correct spot - Congratulations!!!" into field insideIndicator
/*
circle
square
star
triangle
rectangle
octagon
hexagon
pentagon
heptagon
*/
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "square selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsObject2()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
-- these find functions need to be further generalized so that we just use one function for locating positions of images
function whereIsObject2
put the location of image "bigsquare" into o2Coordinates
put item 1 of o2Coordinates into object2Coordinates[1]
put item 2 of o2Coordinates into object2Coordinates[2]
return whereIsTheHole
end whereIsObject2
function whereIsObject
put the location of image "square" into o1Coordinates
--
put item 1 of o1Coordinates into object1Coordinates[1]
put item 2 of o1Coordinates into object1Coordinates[2]
return whereIsTheCircle
end whereIsObject
Hexagon
--Hexagon trying to clean up variables
-- declare variable used for truthcheck
--declaring the object2Coordinates
global object2Coordinates
global object1Coordinates
global truthCheck
local count = 0 -- replace with global count
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put object1Coordinates[1] into field "obj1FieldXPosition"
put object1Coordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put object2Coordinates[1] into field "obj2FieldXPosition"
put object2Coordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( object1Coordinates[1] >= object2Coordinates[1] -30 and object2Coordinates[1] + 26 >= object1Coordinates[1] and object2Coordinates[2] <= object1Coordinates[2] +28 and object2Coordinates[2] +22 >= object1Coordinates[2] ) then
--Add switch with right answers here
put "You put the hexagon in the correct spot - Congratulations!!!" into field insideIndicator
/*
circle
square
star
triangle
rectangle
octagon
hexagon
pentagon
heptagon
*/
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "hexagon selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsObject2()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
-- these find functions need to be further generalized so that we just use one function for locating positions of images
function whereIsObject2
put the location of image "bighexagon" into o2Coordinates
put item 1 of o2Coordinates into object2Coordinates[1]
put item 2 of o2Coordinates into object2Coordinates[2]
return whereIsTheHole
end whereIsObject2
function whereIsObject
put the location of image "hexagon" into o1Coordinates
--
put item 1 of o1Coordinates into object1Coordinates[1]
put item 2 of o1Coordinates into object1Coordinates[2]
return whereIsTheCircle
end whereIsObject
Octagon
--Octagon trying to clean up variables
-- declare variable used for truthcheck
--declaring the object2Coordinates
global object2Coordinates
global object1Coordinates
global truthCheck
local count = 0 -- replace with global count
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put object1Coordinates[1] into field "obj1FieldXPosition"
put object1Coordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put object2Coordinates[1] into field "obj2FieldXPosition"
put object2Coordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( object1Coordinates[1] >= object2Coordinates[1] -30 and object2Coordinates[1] + 26 >= object1Coordinates[1] and object2Coordinates[2] <= object1Coordinates[2] +28 and object2Coordinates[2] +22 >= object1Coordinates[2] ) then
--Add switch with right answers here
put "You put the octagon in the correct spot - Congratulations!!!" into field insideIndicator
/*
circle
square
star
triangle
rectangle
octagon
hexagon
pentagon
heptagon
*/
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "octagon selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsObject2()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
-- these find functions need to be further generalized so that we just use one function for locating positions of images
function whereIsObject2
put the location of image "bigoctagon" into o2Coordinates
put item 1 of o2Coordinates into object2Coordinates[1]
put item 2 of o2Coordinates into object2Coordinates[2]
return whereIsTheHole
end whereIsObject2
function whereIsObject
put the location of image "octagon"into o1Coordinates
--
put item 1 of o1Coordinates into object1Coordinates[1]
put item 2 of o1Coordinates into object1Coordinates[2]
return whereIsTheCircle
end whereIsObject
Pentagon
--Pentagon trying to clean up variables
-- declare variable used for truthcheck
--declaring the object2Coordinates
global object2Coordinates
global object1Coordinates
global truthCheck
local count = 0 -- replace with global count
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put object1Coordinates[1] into field "obj1FieldXPosition"
put object1Coordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put object2Coordinates[1] into field "obj2FieldXPosition"
put object2Coordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( object1Coordinates[1] >= object2Coordinates[1] -30 and object2Coordinates[1] + 26 >= object1Coordinates[1] and object2Coordinates[2] <= object1Coordinates[2] +28 and object2Coordinates[2] +22 >= object1Coordinates[2] ) then
--Add switch with right answers here
put "You put the pentagon in the correct spot - Congratulations!!!" into field insideIndicator
/*
circle
square
star
triangle
rectangle
octagon
hexagon
pentagon
heptagon
*/
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/fsghgfsh
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "pentagon selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsObject2()
get whereIsObfsghgfshject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
-- these find functions need to be further generalized so that we just use one function for locating positions of images
function whereIsObject2
put the location of image "bigpentagon" into o2Coordinates
put item 1 of o2Coordinates into object2Coordinates[1]
put item 2 of o2Coordinates into object2Coordinates[2]
return whereIsTheHole
end whereIsObject2
fsghgfsh
function whereIsObject
put the location of image "pentagon"into o1Coordinates
--
put item 1 of o1Coordinates into object1Coordinates[1]
put item 2 of o1Coordinates into object1Coordinates[2]
return whereIsTheCircle
end whereIsObject
Circle
--Circle
-- declare variabfsghgfshle used for truthcheck
--declaring the cHoleButtonCoordinates
global cHoleButtonCoordinates
global cButtonCoordinates
global truthCheck
local count = 0
-- What to do when clicking on the button
on mouseDown
grab target
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put cButtonCoordinates[1] into field "obj1FieldXPosition"
put cButtonCoordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put cHoleButtonCoordinates[1] into field "obj2FieldXPosition"
put cHoleButtonCoordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( cButtonCoordinates[1] >= cHoleButtonCoordinates[1] -30 and cHoleButtonCoordinates[1] + 26 >= cButtonCoordinates[1] and cHoleButtonCoordinates[2] <= cButtonCoordinates[2] +28 and cHoleButtonCoordinates[2] +22 >= cButtonCoordinates[2] ) then
put "You put the circle in the correct spot - Congratulations!!!" into field insideIndicator
--Add right answers here
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "circle selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsHole()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
function whereIsHole
put the location of image "bigcircle" into circleHoleButtonCoordinates
put item 1 of circleHoleButtonCoordinates into cHoleButtonCoordinates[1]
put item 2 of circleHoleButtonCoordinates into cHoleButtonCoordinates[2]
return whereIsTheHole
end whereIsHole
function whereIsObject
put the location of image "circle"into circleButtonCoordinates
--
put item 1 of circleButtonCoordinates into cButtonCoordinates[1]
put item 2 of circleButtonCoordinates into cButtonCoordinates[2]
return whereIsTheCircle
end whereIsObject
Added the following to all the above objects after the line
EXAMPLE:
put “You put the hexagon in the correct spot -
Congratulations!!!” into field insideIndicator
// --Putting a "right" answers into the variable first we choose what variable we want to add to//
put 2 into answersIdentifier
--Then we launch the calculation
get addNumberTo (answersIdentifier)
--Then for demonstration purposes we display the counter result in our counter field
put the result into field "rightoutput"
Day 19
So how to make the application interact with for instance
payment modules etc. well you won't believe how simple it is to
launch your system browser.
In the Graphical User Interface GUI there
is a button called Support Us I wanted this
button to lead to a page where you can both support financially
as well as contact me, this could be to any other page you can
imagine would be interesting for your users to interact with.
And when I say simple… this is it!
on mouseUp
launch url "http://einarpetersen.com/doku.php?id=wktamsupport_contactform"
end mouseUp
What the above piece of code does is open up the system browser
at your desired url - Doesn't get much easier than that now does
it ?
I could also have written something like
get URL “http://www.example.com/someText.html”
put it into fld “someTextField”
And then instead of opening a browser LiveCode would attempt to
show the text from the Uniform Resource Locator URL
in the text field. And text is the key - if you ask LiveCode to
fetch a txt file that is what you get.
You could use this for creating ticker information etc. just to
give an example of what you could use such functionality for.
I will probably be playing with that as it makes it possible to
show more dynamically updated material in your application.
Anyway - All great but we have a report to make in order to
track the progress of the user
This is the proposed info structure for the report - This report
is (for now) generated by pushing a button
on mouseUp
--Collate the following info into a report
--player ID - this has to be a non person tiable indicator if used for patient tracking, perhaps a hashed value derived from something on the
--device where the app is installed - only problem would then be a patient using different platforms, so a method needs to be deviced to transfer
--ID from device to device, for now we will let the app create a value and then stick with that value into the apps working
--space somehow
--start time/end time/total time symbol 1
--... symbol 2
--... symbol 3
--... symbol 4
-- etc.
--placed incorrectly
-- symbol 1 / times placed incorrectly / times placed correctly
--... symbol 2
--... symbol 3
--... symbol 4
-- etc.
--Level information
--What level is patient on
--write collated information into a file / to disk / to web server / database url
-- secondary project build simple gui to see the data collected in different views (data extraction) for player ID's
--The player ID's can then be referred to a patient within a secure database, this way the patients could use the app without risking exposure
--oine could use TOR nodes and encryption as well so as to ensure maximum patient confidentiality
end mouseUp
As you can see we need to keep track of what is happening to the
individual symbols so we need to create some sort of tracking
container.
We could also keep track of how often each object is grabbed
etc. as this will give an indication of ability to focus on an
individual object etc. but for now let us just track time from
start and till the object reaches the correct destination.
For this we'll use the timing routines created earlier, only now
we will use them to populate our time tracking containers.
--Timing routine for the object
--if value of circletimereport [starttime] = 0 then get time and put into circletimereport [starttime][stoptime][totaltime]
-- startTim()
get startTim()
put the result into circleTimeReport[1]
--to test we need to put circleTimeReport[1] into "calcfield1"
--put circleTimeReport into "ctreport"
put circleTimeReport[1] into field "calcfield"
--"calcfield"
put true into timingStarted
else
put "you already got the time dope" into field "calcfield"
--then do nothing and get on with the job, but just to test if this is really true let us see if we keep getting the same value from our circleTimeReport[1]
put circleTimeReport[1] into field "checkfield"
wait 100
put "" into field "checkfield"
end if
Again you can se I use existing fields and have added another
just to visually check what is going on - you could probably
just send these events to a message window, but for now we're
keeping it on screen.
Day 20
Been spending a lot of time promoting rather than coding as I
really need LiveCode to succeed so I can use what I've learned
so far for a noble purpose…
I've added timing functionalty to the object, this means that
the objects can now be timed and the total time used to move the
hole to the correct spot can be calculated
Later we can add a counter counting up on every mouse click so
we can see how often the player has clicked, we can get an idea
of ability to focus on the task at hand as well as ability for
ongoing movements etc. if we do this.
The timing functionality feeds the circleTimeReport array with
values from startTim() stopTim() timeUsed()
The values in the circleTimeReport can now be added to our
overall usage report - The next test is to expand the timing to
encompass all the objects.
-- declare variable used for truthcheck
--declaring the cHoleButtonCoordinates
global cHoleButtonCoordinates
global cButtonCoordinates
global truthCheck
local count = 0
global timeStart
local timeCheck
local timingStarted = false
global circleTimeReport
-- What to do when clicking on the button
on mouseDown
grab target
if false is in timingStarted then
--Timing routine for the object
--if value of circletimereport [starttime] = 0 then get time and put into circletimereport [starttime][stoptime][totaltime]
-- startTim()
get startTim()
put the result into circleTimeReport[1]
--to test we need to put circleTimeReport[1] into "calcfield1"
--put circleTimeReport into "ctreport"
put circleTimeReport[1] into field "calcfield"
--"calcfield"
put true into timingStarted
else
--put "you already got the time dope" into field "calcfield"
--do nothing and get on with the job but just to test let us see if we keep getting the same value from our circleTimeReport[1]
put circleTimeReport[1] into field "checkfield"
end if
get setTruth()
get checkTruthValue()
put the result into field "xyCoordEnd"
repeat until the mouseClick with messages
get positionOfMouse()
put the result into field "xyCoordLive"
wait 100 millisecs with messages
---- the 100 ms wait is introduces based on fears of system hanging according to LiveCode
----discussion on cochlar program and mouseclocks that sounded akin to our old T-Board project
-- As of right now our collission detection is all placed in the release phase of the mouse
-- We can move the colission detection here to get a dynamic check while we are moving the circle around
end repeat
end mouseDown
on mouseUp
----Here we need to introduce behaviour in the form of calling functions and remove all logic possible to functions and into data structures
--First off we ned to make sure where the two objects are
get inTheRightPlace()
--To visually appreciate that we have indeed gotten the data we will proceed to put them into text fields on screen
--We begin with the coordinates of the circle
put cButtonCoordinates[1] into field "obj1FieldXPosition"
put cButtonCoordinates[2] into field "obj1FieldYPosition"
--Then we proceed with the coordinates of the hole
put cHoleButtonCoordinates[1] into field "obj2FieldXPosition"
put cHoleButtonCoordinates[2] into field "obj2FieldYPosition"
--- Since we know where the two objects are now we can do a location check to see if they intersect as we want them to and make sure
--that the correct shape is selected - if both conditions are met " hooray" answer else nothing - We use the text box as to not get caught in an answerbox loop
--with answerbox popping up all the time because a potential location check is running (see above comments on dynamic location check)
if ( cButtonCoordinates[1] >= cHoleButtonCoordinates[1] -30 and cHoleButtonCoordinates[1] + 26 >= cButtonCoordinates[1] and cHoleButtonCoordinates[2] <= cButtonCoordinates[2] +28 and cHoleButtonCoordinates[2] +22 >= cButtonCoordinates[2] ) then
put "You put the circle in the correct spot - Congratulations!!!" into field insideIndicator
--Putting a "right" answers into the variable first we choose what variable we want to add to
put 2 into answersIdentifier
--Then we launch the calculation
get addNumberTo (answersIdentifier)
--Then for demonstration purposes we display the counter result in our counter field
put the result into field "rightoutput"
-- stopTim()
get stopTim()
put the result into circleTimeReport[2]
put circleTimeReport[2] into field "calcfield2"
get usedTim()
put the result into circleTimeReport[3]
put circleTimeReport[3] into field "calcfield3"
else
/*This is a simple message that we are not successfull it could however be something else like triggering a function
It needs to be expanded to a check if on top of anotherhole
This will basically be a if on top of "wrong image name"
put "+1" into wrong answers counter and put text "Please move the " +NAME_OF_OBJECT_LAST_DRAGGED" into the hole with a similar shape"
*/
put "Not there yet" into field insideIndicator
wait 50
end if
end mouseUp
function positionOfMouse
return mouseLoc()
end positionOfMouse
function setTruth
put "circle selected" into truthCheck
--By putting 1 into the variable truth check we determine it is object 1,
--need to rename to something more meaningfull and to put 1 into the check when we have more than one object to move
end setTruth
function checkTruthValue
return truthCheck
end checkTruthValue
function inTheRightPlace
--This function will hold the code for the truthcheck as to if the position is correct, that way we can create a general routine for
--checking all the objects
--pseudo code: get obj1 location get obj2 location - are these within same location +/- margin - if correct goto isPlacedCorrectly()
--else do nothing spectacular and return
--pseudo code: get obj1 location
get whereIsHole()
get whereIsObject()
-- are these within same location +/- margin
return correctLocation
end inTheRightPlace
function whereIsHole
put the location of image "bigcircle" into circleHoleButtonCoordinates
put item 1 of circleHoleButtonCoordinates into cHoleButtonCoordinates[1]
put item 2 of circleHoleButtonCoordinates into cHoleButtonCoordinates[2]
return whereIsTheHole
end whereIsHole
function whereIsObject
put the location of image "circle"into circleButtonCoordinates
--
put item 1 of circleButtonCoordinates into cButtonCoordinates[1]
put item 2 of circleButtonCoordinates into cButtonCoordinates[2]
return whereIsTheCircle
end whereIsObject
– more to come
350+
Tonight we broke 350.000 - What a grand run it was… time to
celebrate… what more appropriate than FREE SOFTWARE AND FREE
BEER… and I kinda like the ring of the name too :)
"http://einarpetersen.com/images/IMG_20130226_224455.jpeg Free Software and Free Beer - What a life ;)
http://www.kicktraq.com/projects/1755283828/open-source-edition-of-livecode/ http://www.kicktraq.com/projects/1755283828/open-source-edition-of-livecode/minichart.png
Open Source Edition of LiveCode -- Kicktraq Mini
Open Source Edition of LiveCode -- Kicktraq Mini
Day 21
Heading towards stretch goals, a few more media outlets
contacted… crossing my fingers for 441,000+
Planned to be doing some coding tonight. But spent more time on
the Kickstarter trying to come up with ways to promote.
Put timing on one more button and played around with a very
nifty feature that we will be using for our application - Fading
buttons out of existence :) - Will need to look at how to set
them unclickable and clickable - the fading bit is pretty
straight forward.
on mouseDown
grab me
end mouseDown
on mouseUp
--hide button "one" with visual effect dissolve
-- fade out
repeat with i = 1 to 100
set the blendLevel of button "fader" to i
wait 1
end repeat
wait 100
--NOTICE The wait routine is useless in this respect as we cant affort to wait around for anything, we need to make the button unclickable
-- after we fade it out.
--The best we can do for this POC is to record some start position and move the button there and make it visible and clickable
--when we need it with our restart button, best bet would be to create the positioning first, then make visible and clickable
--While testing a simple version can be implemented in the mouseup that simply moved the button and fades the button in
-- Move button to a preset position
-- fade in for demonstration purposes
repeat with i = 100 down to 1
set the blendLevel of button "fader" to i
wait 1
end repeat
end mouseUp
Day 22
So yesterday we figured out how to fade a button out and in, and
we also figured out that it is no good to use the wait routine
in our case for fading back in, we also realized that if we kept
the buttons faded out they might still be clickable and also
that they might be darn hard to find if they were invisible so
there are a coupe of things to do
First we need to make the button disappear when we successfully
place it in the circle - using the same coding style as we did
with the button exchanging button with image
and then the image name instead of the button name we get a cool
dissolving effect when the button is placed correctly
We do it right after placing our timing object (TODO) in the
report list (we have a code remark in the object already telling
us we need to be doing this).
Anyway this is the code you need to fade the button out placed
right after the remark with some ekstra remarks about what we
are doing.
-- Here circleTimeReport needs to be placed in a list that can be used for our report.
--hide button "circle" with visual effect dissolve
-- fade out
repeat with i = 1 to 100
set the blendLevel of the image "circle" to i
wait 1
end repeat
Basically what we do is that we move the circle to a predefined
location, since we had our x,y coordinates typed out while we
drag our objects around it is relatively easy to find the
coordinates.
Another way would be to do an ordered or random placement of
objects upon reset, but for now we'll stay with a fixed setup.
Once we have moved the circle to where we want it to be when we
begin our session we fade it in - and that is what happens in
the code snippet below.
To make it nice it would be possible to do a general script that
faded in all the objects according to a list and used the same
function for doing all of them, the function would look roughly
as below, only you'd exchange the coordinates with variables
that you could feed and the name would be exchanged with a
variable as well… I should do that in the final version but here
is how the code looks for a single button “reset” to starting
position and state.
on mouseUp
set the loc of image "circle" to 119,190
-- fade in for demonstration purposes
repeat with i = 100 down to 1
set the blendLevel of image "circle" to i
wait 1
end repeat
end mouseUp
This is how we in a very raw way re initialize more than one
object
on mouseUp
set the loc of image "circle" to 119,190
set the loc of image "triangle" to 34,264
-- fade in for demonstration purposes
repeat with i = 100 down to 1
set the blendLevel of image "circle" to i
set the blendLevel of image "triangle" to i
wait 1
end repeat
end mouseUp
<7code>
We will be adding functionality to make the button not clickable so as to avoid the button remaining active after being faded out. And then the initialization will make it clickable again.
I imagine we'll do a setLoc function and a fadeInOut function, the first function will enable us to set the location of an object of a type to a specified x,y and the latter will enable us to do graphic manipulation on a specified object of a specified type, maybe even according to different levels of fade.
To test if we can disable enable buttons we create the following test buttons
An enable button
<code>
on mouseUp
--Use the enable/disable button command
enable button "test_b"
end mouseUp
A disable button
on mouseUp
--Use the enable/disable button command
enable button "test_b"
end mouseUp
The button we want to manipulate
on mouseUp
put "I can be clicked" into field "errormessages"
end mouseUp
Okay so that works - Can we now do the same for the control
objects and will we see any adverse graphical effects.
Indeed - simply exchanging the button with image and naturally
the control name to circle instead of test_b we achieve exactly
the result we want.
Here an example for enabling the control again - i.e. image
“circle”
on mouseUp
--Use the enable/disable button command
enable image "circle"
end mouseUp
We can now proceed to create a function enabling us to enable or
disable specific control types. And build the function so as to
allow us to disable any object given the correct variables.
I imagine something akin to
function enableObject objectName
enable image objectName
end enableObject Objectname
But I think it is time to catch some shut eye… total time played
around today coding and figuring things out… an hour and a half
or so - Remember, for a seasoned user this would be trivial, I
do not know the syntax nor the environment so I am pretty happy
about the time spent.
I believe a trained coder could probably have created the
application in a just few hours from concept to finished POC.
Day 23
So I tried to compile just for fun today and running on Linux
without a hitch… going to test on a windows and possibly a Mac
later.
Created the code for the Exit button - If more than one stack is
open I gather you'd need to heed that and code accordingly.
But to exit stack this is the code you need - REMEMBER TO SAVE
BEFORE YOU TRY IT!!!!
on mouseUp
answer question "Are you sure you want to exit" with "Yes" or "No"
if it is "Yes"
then
lock messages
quit
end if
end mouseUp
Less than 10 minutes used for coding today includes googling for
info :) - Hard to concentrate today, big party upstairs
neighbours, so did not get any good sleep….
I found however compiled version did not exit stack as expected,
worked in uncompiled version - So after searching a little I
found this solution
lock messages
quit
And replaced the code in Exit with what you see above instead of
the close “stackname” - I do not know enough about the
environment to explain why quit works and close does not but for
now that's the way it's going to be.
Day 24
Today I've been looking at our report - What we needed for this
POC is to be able to write a text report. At some later time we
might be looking at databases etc. but for now we'll concentrate
on writing a report to a file.
This is a very good exercise as we by writing the report to a
file can get a better overview of the data we are trying to put
into a report and we'll be able to ponder upon exactly how we
should format the data in order to generate an easy to enterprit
view of the data we collect as listing them in a good manner is
as important as gathering them for the understanding of a users
abilities for his her physicians or th eusers own understanding
depending on how you present it.
So in our generate report button we need to declare our time
report variables - As our primary object of interest is our
circle let us begin by creating report entires concerning the
circle.
However there is something to keep in mind, we do not have an
interest in overwriting data so we will be appending to the file
instead every time we press generate report.
global circleTimeReport
open file "///home/ep/data/globabilityorg/livecodeprograms/report_symbol_tracker.txt" for append
write circleTimeReport[3] & return to file "///home/ep/data/globabilityorg/livecodeprograms/report_symbol_tracker.txt"
close file "///home/ep/data/globabilityorg/livecodeprograms/report_symbol_tracker.txt"
The code above results in date being written to the file
report_symbol_tracker.txt
Situated in a directory called
./home/ep/data/globabilityorg/livecodeprograms/
This directory needs for the final application to be changed to
a data directory on the system where the application is to be
run, but for now we'll keep a hardcoded path and filename.
Notice that the file is being opened and closed - This is quite
important as data is written upon file being closed.
If you have loads of data it might be better to collect in
memory and then write once your buffer is full so at to avoid
constant read / write operations to your disk etc.
The following displays how I progressed in choosing the form of
my report to appear to the reader.
577084
577084
577084
577084
577084,blabla
577084,blabla
577084,blabla
577084,blabla
577084,blabla
Total time used: ,577084
Total time used: ,577084
Total time used: ,577084
Total time used: ,577084
Total time used: ,577084
Total time used: 577084
Total time used: 577084
Total time used: 577084
CircleStart time: 1362328552368End time: 1362329129452Total time used: 577084
CircleStart time: 1362328552368End time: 1362329129452Total time used: 577084
CircleStart time: 1362328552368End time: 1362329129452Total time used: 577084
CircleStart time: 1362328552368End time: 1362329129452Total time used: 577084
Circle: Start time: 1362328552368 End time: 1362329129452 Total time used: 577084
Circle: Start time: 1362328552368 End time: 1362329129452 Total time used: 577084
Circle: Start time: 1362328552368 End time: 1362329129452 Total time used: 577084
Object: Circle - Start time: 1362328552368 End time: 1362329129452 Total time used: 577084
Object: Circle - Start time: 1362328552368 End time: 1362329129452 Total time used: 577084
Object: Circle - Start time: 1362328552368 End time: 1362329129452 Total time used: 577084
Object: Circle - Start time: 1362328552368 - End time: 1362329129452 - Total time used: 577084
Object: Circle - Start time: 1362328552368 - End time: 1362329129452 - Total time used: 577084
Object: Circle - Start time: 1362328552368 - End time: 1362329129452 - Total time used: 577084
Object: Circle - Start time: 1362328552368 - End time: 1362329129452 - Total time used: 577084
As you can see the final look of the report file will be
something like this, yes I know the time looks weird, but this
is due to it being the clock in milliseconds unix time, so some
transformation might be needed to get the data even more human
readable.
Object: Circle - Start time: 1362328552368 - End time:
1362329129452 - Total time used: 577084
You will notice some things hard coded into the code below - The
idea is that in the future such a line can be changed further so
that object name (here Circle) becomes a variable changing with
whatever object chosen and the same with the different things we
are choosing to write to our file.
But for now we'll stick with the hard coded info. You can play
with spaces and separators to find your own ideal view, however
later we will be putting this data into some XML like structure
using human readable tags that could then be used as unique
column names is SQL databases etc.
open file "///home/ep/data/globabilityorg/livecodeprograms/report_symbol_tracker.txt" for append
write "Object: Circle - " & "Start time: " & circleTimeReport[1] & " - End time: " & circleTimeReport[2] & " - Total time used: " & circleTimeReport[3] & return to file "///home/ep/data/globabilityorg/livecodeprograms/report_symbol_tracker.txt"
close file "///home/ep/data/globabilityorg/livecodeprograms/report_symbol_tracker.txt"
Day 25
With us being able to write our report we also need to be able
to do it more than once, this means as soon as we write a
successfull attempt to the report we need to reset our
circleTimeReport
This is done by putting 0 into each of the counters.
By doing this we should be able to write multiple attempts with
differing start and stop times as well as calculated time used
into our report.
--reset circleTimeReport
put "0" into circleTimeReport[1]
put "0" into circleTimeReport[2]
put "0" into circleTimeReport[3]
While strictly not needed purging the circleTimeReport feels
more correct. Particularly as the plan is to take the
circleTimeReport variable and transform it into a general
variable callable by all our “objects” and then establish a more
formal structure in memory to hold our timekeeping before
writing it to the report.
This above will be done in our generate report button script.
In addition after our fade out we insert some code to be able to
restart timing our object, we need to remember that at this
point no report is generated, this means if we reset our start
time is lost forever.
All his logic also needs to be moved out of the buttons and they
should only call a buttonhandler script and identify themselves
this to better adhere to the MVC pattern (Model View Controller)
by implementing a MVC pattern changes in logic will be easier to
implement and each change can have minimum effect on already
established parts.
That is done in the circle button script for now as the current
variable to keep track of if timing is started or not is a local
boolean true or false setting.
repeat with i = 1 to 100
set the blendLevel of the image "circle" to i
wait 1
end repeat
--In order to begin a new timing on an object we need to set the timing started to false
put false into timingStarted
Not too long used today… minutes really, lot's of distractions
today after a long day at work… Would be nice to be able to
dedicate my time to this… So if you have some cash spare, feel
free to make a donation to allow me and others to work towards
the creation of free software for the sick or disabled full
time….
Anyway - think next step should be thinking about putting a
counter into the timereport this would be the number of times
the circle has been placed correctly and should be multiplied
upon correct placement.
The number could then be displayed in the report as Pass number:
xx
This number will be a global called circlePassCounter, we shall
when logic functions build a counter structure that can hold
multiple counters as explained earlier, and then add counters
for other objects / purposes as well.
Day 26
Time for coding none - Time used to ponder upon datastructures
for further progress a couple of hours.
While not complete the below text holds a more structured view
on creating a general datastructure holding the information of
for example circleTimeReport as well as the proposed
circlePassCounter.
The scorecard would probably be the perfect holding place for
all this information about our objects.
But as we are actually working on generating a report based on
those numbers, why not continue to define a data structure there
that better enables us to add information on the different
objects that can be move about on the screen and that we find of
value for the training session. We can then when we are
satisfied with the general structure move it to the scorecard,
then create a data structure that can encompass multiple
structures for different users etc.
Maybe something like populating an array with arrays holding all
the information mentioned hereunder…
We already have some information for our report in place but
let's make our report a little more complete.
progressReport[metaDescription][objectIdentifier][objectName][startTime][stopTime][usedTime][passNumber][sessionsNumber][userIdentifier].
For now we will hardcode a metadescription into the structure,
but in time we will dynamically be creating the datastructure
including the metadescription.
The metaDescription can be used for database purposes describing
the values we would like to put into one or more tables - I will
not go into separating data into 3 normal form here (an SQL
related term), but when you design your arrays you should do
yourself a favor an try to create groupings that logically make
sense as well as optimizing them datawise.
Here a description of the fields in the progressReport array.
[metaDescription] - Array holding variables containing
dynamically changeable information on objects that can be moved
about on screen.
[objectIdentifier] - The objectIdentifier is a unique number, we
give our objects to make it easier to programattically refer to
them
[objectName] - The objectName, is simply a name in human
readable form. It can be Circle, Square, Triangle or any of the
other shapes used in our trainer
[startTime] - For each pass there is a startTime commencing the
moment the shape is clicked
[stopTime] - For each pass there is a stopTime that is read the
moment the shape is placed correctly
[usedTime] - For each pass there is a total of usedTime that is
calculated the moment the shape is placed correctly, we use this
time in our report a database would not need this information as
it is a value that can be calculated and as it is a simple
calculation not requiring massive computing power there is no
need to save this variable. But for our txt report it will come
in handy to store it in our array.
[passNumber] - passNumber is simply a counter that keeps track
of what pass a specific timing event is for, these should all be
tallied together as they are also useable elsewhere and not just
as an identification of how a specific pass has been carried
out.
[sessionsNumber] - sessionNumber is the number of the last
session i.e. sessionsCounter + 1, this number “sessionsCounter”
you can extract from data in the answersCountReport where
sessionsCounter is stored.
[userIdentifier] - userIdentifier has to be a non person
identifiable identifier that can then in a doctors database be
related to a specific patient. Why non person identifiable ?
Simple - To protect privacy - The application might be deployed
in an environment where it sends information over the internet
so to protect the user we need a non person identifiable
identifier as a placeholder so that the information regarding
training sessions potentially done at home will not be misused.
answersCountReport
Another bite of data that might be interesting to put in a
report for a doctor will be numbers of correct and wrong answers
for a particular patient/player.
answersCountReport[metaDescription][userIdentifier][rightAnswers][wrongAnswers][sessionsCounter]
[metaDescription] - Array holding variables containing some
dynamically changeable information on a users interaction with
the application as well as information not intended to be
dynamically chaged per session.
[userIdentifier] - This is the same userIdentifier as described
above
[rightAnswers] - This is the number of right answers in total
given for a specific person over the course of a number of
sessions
[wrongAnswers] - This is the number of right answers in total
given for a specific person over the course of a number of
sessions
[sessionsCounter] - This is the total number of sessions carried
out by the specific person in question
Day 27
Going to be working from morning Day 27 till morning Day 28, so
no coding today
Day 28
Been working from yesterday morning till early morning today -
After a few hrs. of sleep been trying to finish up the working
week.
Evening now and would like to be coding but honestly doubt I'll
be able to do any sensible work tonight other that preparing a
livedistro and see if I can put a version of livecode onto the
LiveDisk and with the current activision can keep coding or I
need to have a new code or something.
Comments regarding the LiveCode Kickstarter
Comment made regarding the LiveCode Kickstarter - Kickstarter here
Great you are aiming at GLP'ing this platform, all software
should be open sourced and free of patents only if this is the
case we will see another golden age of computing as I remembered
with the good old ZX-81 and the Spectrum where creating programs
was just something you did for fun and everyone did it. I
applaud your initiative - I've downloaded a trial from your site
and will give it a spin creating a free app to help stroke
victims and if it works I'll look at creating a few more using
this platform. Also you should consider already now to allow
people creating apps for all platforms in your 60 day trial if
you are serious about going the open source way. Perhaps even
skipping the whole 60 day limitation altogether already now if
you are truly serious about this. I really hope you will reach
your goal and will be trying to promote it if I'm happy about
usability and end result.
Comment made regarding the LiveCode Kickstarter - Kickstarter here
Here's a thought if it has not already been mentioned - Why not
make the complete commercial packages available, as a revenue
sharing deal, in addition to the standard license set up you
have right now.
imagine you getting 1% of the earnings from apps created if they
become a hit.
Then people can if they have an overnight success and they wish
to “buy” you out invest in the regular licenses after earning a
certain amount of money - perhaps roughly what the tools would
have cost them plus a little extra to you guys for being nice
enough to offer the platform or people might by staying in the
revenue sharing deal get perpetual updates and other perks that
others might not have access to.
That way you could open up your entire platform for thousands of
developers immediately who do not have the ability to pony up
the cash up front and you might actually gain additional
traction from such a move building an even bigger community
right here and now.
I would also recommend considering free rides for charitable
software developers making their products made with LiveCode
freely available at no cost to the general public… “DISCLAIMER”
yes I do fall into the latter category myself and am right now
running a little LiveCode tryout to see if I can create a minute
application that can be used in connection with stroke victim
rehabilitation and if it works I am quite certain more will
follow. If there are any avid users here already I have multiple
of ideas for Open-Source Software FOSS
apps that need to be made and no money or time myself but would
welcome inquiries into an opportunity to help us out.
I'm doing my little tryout at http://einarpetersen.com
- it is crude, will take eons of time compared to the
demonstrations you have seen here, but the intent is fair and I
hope I in this way can help create some interest for the
Kickstarter as well… I will try to tweet a little on my
sina.weibo profile about this kickstarter and my pledge, as well
as I have already done on my other social networking platforms.
Once again - What a great initiative and wishing you guys the
best of luck with the Kickstarter.
Comment made regarding the LiveCode Kickstarter - Kickstarter here
@RunRev & @Sean O'Connor Too bad about the details not being
released to you but I guess Kickstarter is trying to protect
itself from potential misuse as well…
@Sean O'Connor I agree with the comment below that the campaign
is rather invisible to the world and that is actually too bad,
because it is quite a worthy cause to see an environment like
this being GPL3'ed.
I did write the FSF about the Kickstarter attempts and I have
tried to blog on sina weibo (chinese twitter/facebook social
network) as well as on my other social platforms G+ / Facebook -
As well as running a dev test on my own site, that will be
available through The Global Ability Initiative as soon as
functionality is a little higher.
@All I suggest everyone interested in seeing this Kickstarter
succeed, get working hard on spreading the news and if you at
all can go that extra mile when you pledge.
I think the environment is pretty interesting, at day 5 of my
LiveCode Experiment where I've basically only fiddled around a
from minutes to a few hours per day. I have been able to,
without knowing the development environment, nor the syntax
beforehand and more or less without reading the manual… to move
buttons about on screen, track their locations and determine if
they are in the right place and making simple collision
detection based on coordinates.
I can see that the current state of development, will enable me
to use the object behaviour and data, as basis for puzzles etc.
and for future use in place of buttons, I could put objects
consisting of animated sprites etc. instead making it possible
to create dynamic games as well, with what I expect would be a
minor amount of code, compared to what I would have to get into,
if I coded in something else like Java or Javascript.
Yeah I know it is crude code but like I said I'm just playing
around and truly hope sound will be as easy as well as I have
applications in need of good playback capability and have had
difficulty in clean playback using HTML5 because of soundbite
size and the way HTML5 seems to handle sound… If this is
successful and I can do a cross platform compilation test and
see that this is also okay then The Global Ability Initiative
will be releasing a couple of further applications based on
LiveCode as gratis FOSS, so as you can expect I really excited
to see how well the experiment will pan out.
I strongly believe that if the above is in place I have found an
environment in which to develop future applications that need to
be cross platform.
@RunRev - Really looking forward to further project updates!
Perhaps RunRev could provide a list of media coverage so that
those of us posting on our social media platforms can push this
material as well to increase visibility and notability of your
project and also know what media we do not need to push to write
about the Kickstarter etc.
Kind Regards
Einar Petersen
Comment made regarding the LiveCode Kickstarter - Kickstarter here
@Sean O'Connor / @RunRev
Yes the promotion seems to be low key and a project like this
needs a lot of traction to truly get going, the more RunRev
shouts out the better are their chances of reaching their
milestone which is still some way off.
This is why I am asking about press coverage as it is vitally
important to get good coverage as soon as possible.
Comment made regarding the LiveCode Kickstarter - Kickstarter here
@Shawn, yup this is precisely the kind of stuff we need to
assist in the promotion of this project
@All - Remember to declare your locals and globals if you intend
to keep your hair intact and not seem like a rambling madman to
your wife cursing yourself, the machine and everything IT while
fighting to get fields updated with information you know is
there but just can't squeeze out…
Nevertheless I'm having fun with my LiveCode Experiment and hope
through my blogging to at least be of mild entertainment to my
readers…
But I'll be seeing if I could somehow squeeze that graphic into
my stream tonight before bedtime…
@RunRev what is happening with that list of outlets mentioned
that are already talking about the LiveCode Kickstarter -
publishing the list with links to press also helps you get
better ranking etc. and it give us backers a possibility to link
to material backing our enthusiasm for the environment.
A continually updated list would be appreciated and is strongly
recommended, also do an app marathon this weekend, invite people
to participate and see what amazing stuff could be created in
the course of 48 hrs…, and if you do not have it already I
strongly suggest putting resources on a massive press push an
app marathon could be what sparked the interest of the tech
press.
You're almost a third of the way now, keep fighting the good
fight!
http://www.linuxin.dk/node/20733
Spændende Kickstarter - Open Source Edition of LiveCode (GPL3)
Hejsa
Indtil for blot et par dage siden havde jeg ikke hørt om
LiveCode, men så faldt jeg over en artikkel om transition fra
closed source til Open Source
http://www.networkworld.com/community/blog/can-clo…
Åbenbart så er de i gang med en Kickstarter der går ud på at
smide softwaren ud som GPL3 hvis deres Kickstarter er
successfuld.
Du kan finde Kickstarteren her: http://www.kickstarter.com/projects/1755283828/ope…
Jeg kendte ikke LiveCode platformen, men kunne ikke efter at
have set deres promo lade være med at downloade deres 60 dages
demo til Linux.
Jeg har siddet og leget lidt http://einarpetersen.com/livecodeexper.html… DEADLINK
- Ja ja da - koden er vildt grim som jeg har flikket sammen og
ikke særlig objektorienteret… men jeg leger kun og så må jeg
indrømme at jeg ikke har kigget frygtelig meget i manualen :) ah
well…
Det der tiltaler mig ved LiveCode Kickstarteren er at de har et
udviklingsværktøj som du kan lave cross platform kompilering til
og som de vil gøre tilgængelig under GPL3.
Umiddelbart synes miljøet lynhurtigt at lære og syntax
strukturen simplere end f.eks. Java eller Javascript det er lidt
svært at vænne sig til ikke at skulle skrive alenlange sætninger
:)
Jeg kunne derfor ikke lade være med at tegne mig som pledger af
principielle årsager - Synes det er enormt fantastisk at se
udviklingsværktøjer som dette blive released som GPL3.
Det synes Steve Wozniak og Cory Doctorow åbenbart også og de har
også tegnet sig for hver deres pledge og når “respektable”
folksom disse tegner sig som pledgers så er projektet nok heller
ikke helt ved siden af.
Jeg kunne godt tænke mig at høre - Er der andre her som af
principielle årsager kunne finde på at pledge til et sådant
projekt eller er det helt hen i vejret at tænke således efter
jeres mening ?
http://tnbforum.com/viewtopic.php?f=24&t=41892
Kickstarter campaign to Open Source the LiveCode environment
under a GPL3 license
Yup you heard it here first :)
I came across a really exciting Kickstarter the other day and it
seems I am not alone in being intrigued.
Apple co-founder Steve Wozniak believes so much in British
Software Company's vision for School Kids' education that he has
made a considerable pledge to RunRev's kickstarter campaign to
Open Source the LiveCode environment under a GPL3 license as
does Cory Doctorow…
I've been playing around with the environment and suggest that
if you are a programmer hobbyist or seasoned that you test the
environment you will find links to RunRev's homepage from their
Kickstarter campaign and there you can get your hands on a 60
day trial, and hopefully if the Kickstarter is successful a GPL3
licensed community edition with the full capabilities. If you
suddenly want to go commercial and hide what you program i you
can purchase an enterprise edition.
You can find my beginning dabblings with LiveCode here
einarpetersen.com/doku.php?id=livecodeexperiment - eventually
I'll make a proper tutorial if I succeed. I'm making a simple
app to train dexterity and test logical abilities for stroke
victims that will report back to doctors etc. so they can follow
their patients progress, it'll be free and open source off
course.
Why am I writing a post about LiveCode here - Well I have to
admit I have a vested interest in seeing the Kickstarter
succeed, after playing around I decided to become a backer of
this project by making a pledge not just because I feel it is an
interesting development environment but also as I am an avid
proponent of Open Source wanted and wanted to do my bit to make
this Kickstarter a success and suggest that if you find the
project remotely interesting that you make a pledge yourself!
After all we are all interested in better tools and speeding up
development time.
Something else that is extremely interesting with the LiveCode
environment is the ability to write once and then compile to
multiple operating systems, both mobile and desktop and totally
cross platform.
I also think the the environment is perfect for teaching non
programmers to program as the syntax is very natural language
like. But at the same time I think it is also quite suitable for
both hobbyists as well as seasoned programmers
The campaign at the time of writing stands at 927 Backers having
pledged £112,467 towards the £350,000 goal with 12 days to go.
But enough talk, you can find the Kickstarter here:
kickstarter.com/projects/1755283828/open-source-edition-of-livecode
And even if you can't support the Kickstarter financially you
can help create the buzz that it needs to happen to make this
Kickstarter a success.
Whatever you do I hope you have fun and that you want to support
the efforts to make LiveCode a GPL3 product.
https://www.linuxquestions.org/questions/showthread.php?p=4892519#post4892519
Post on Linuxquestions
Yup you heard it here first :)
I came across a really exciting Kickstarter the other day and it
seems I am not alone in being intrigued.
Apple co-founder Steve Wozniak believes so much in British
Software Company's vision for School Kids' education that he has
made a considerable pledge to RunRev's Kickstarter campaign to
Open Source the LiveCode environment under a GPL3 license as
does Cory Doctorow…
I've been playing around with the environment and suggest that
if you are a programmer hobbyist or seasoned programmer, that
you test the environment, you will find links to RunRev's
homepage from their Kickstarter campaign mentioned further down
and there you can get your hands on a 60 day trial and hopefully
if the Kickstarter is successful we'll all freely be downloading
a GPL3 licensed community edition with the full capabilities
soon. If you suddenly want to go commercial and hide what you
program in you can always purchase an enterprise edition so this
is for people Free Open-Source Software" FOSS as well as the more…
well err sneaky types ;)
You can find my beginning dabblings with LiveCode here
einarpetersen.com/livecodeexperiment.html - The code is
gross at the moment as I haven't really read the manual, but
eventually I'll make a proper tutorial of my little project if I
succeed. I'm making a simple app to train dexterity and test
logical abilities for stroke victims, that will report back to
doctors etc. so they can follow their patients progress, it'll
be free and open source off course. Have tonnes of small
projects like this if anyone would like to help regarding The
Global Ability Initiative and free software for the disabled,
just give me a ping.
Why am I writing a post about LiveCode here - Well I have to
admit I have a vested interest in seeing the Kickstarter
succeed, after playing around I decided to become a backer of
this project as well by making a pledge, not just because I feel
it is an interesting development environment but also as I am an
avid proponent of Open Source wanted and wanted to do my bit to
make this Kickstarter a success and I suggest that if you find
the project remotely interesting, that you also make a pledge
yourself!
After all we are all interested in better tools and speeding up
development time and if we can do it with GNU
General Public License GPL tools all the better.
Something else that is extremely interesting with the LiveCode
environment is the ability to write once and then compile to
multiple operating systems, both mobile and desktop and totally
cross platform.
I also think the the environment seems perfect for teaching non
programmers to program as the syntax is very natural language
like.
But at the same time I think it is also quite suitable for both
hobbyists as well as seasoned programmers.
The campaign at the time of writing stands at 927 Backers having
pledged £112,467 towards the £350,000 goal with 12 days to go.
But enough talk, you can find the Kickstarter here:
kickstarter.com/projects/1755283828/open-source-edition-of-livecode
And even if you can't support the Kickstarter financially you
can help create the buzz that it needs to happen to make this
Kickstarter a success.
Whatever you do I hope you have fun and that you want to support
the efforts to make LiveCode a GPL3 product.
Comments made about Kickstarter - www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode
Einar Petersen about 2 hours ago
So today I've been trying to find places where I could
legitimately post threads about the LiveCode Kickstarter within
my social sphere, both publicly as well as internally on
intranet in my professional circles and at the same time without
it being considered spam…,
I've posted most of the comments and links to said comments on
my page you can find them below the chapter http://einarpetersen.com/doku.php…
of my own little LiveCodeExperiment - I suggest all of you think
about where and how you yourselves can do something similar in
order to propel the Kickstarter forward…
Take care - Keep up the good work!
@Cyril Pruszko - had a brief look and commend you on the links
and work you posted!
Those of you interested in playing a little with LiveCode would
do yourself a favour by checking it out…
Hey there, so what to do to get the message out… Well I've take
to Facebook advertising :) As in real ADVERTISEMENTS.
I wanted a simple message something like:
Code in Linux, Mac or Windows, write once.
Deploy to iOS, Android, Linux, Macintosh, Windows, profit ???
Must be expensive…
No FREE if you want it to be!!!
http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode
This is what I actually ended up with, due to space, punctuation
restriction, a 10 US$ daily budget, 0,41 per click, running from
today to 27'th.
The ad has the following audience:
US - 18+
- Broad Categories, Business/Technology: Computer Programming,
Education Teaching, Small Business Owners
Narrow Categories: #Computer programming, #Computer science,
#Source code, #Comment (computer programming), #Porting
In total targetted at 409380 people
The text of the AD
Next Generation LiveCode
Deploy to iOS, Android, Linux, Macintosh, Windows. Expensive?
FREE if you want it to be!
http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode
The advertisement has been approved - hope it helps, if any of
you are in the position to do anything like this maybe you
should try it.
Let's see if we can't pull this one off, the projection says
we're inches away - let us get some momentum rolling!!!
Also submitted to Kickstarter as a suggestion :)
@Kickstarter - how about an option where a project can put a
hold on taking in more pledges and within a reasonable
timeperiod request pledgers to vote on a possible extension of
the project, the vote could be based on general majority i.e. if
70% voted the project was allowed to extend the deadline for
completion. Those that did not agree would automatically be
absolved from any pledge made. This could help projects that are
very close to completing to achieve their goals. You could say
projects needed to be past a certain milestone i.e. at least 50%
of funding secured so as to make sure only projects with an
active community would be able to do something akin to an
extension. Kickstarter could even take 1% or more in addtional
fees just to make sure this feature did not appeal to projects
on an infinite basis. Project not past the 50% mark should
repost with adjusted goals so as to reflect actual interest or
realism. Now there I said it… it's in the open so nobody can
patent this “method for extending crowd funding project funding
period” or whatever such a patent might be called :) Hope
Kickstater would like to implement anyway…
Will not be posting further Kickstarter comments for now… unless
something interesting comes up - https://sites.google.com/a/pgcps.org/livecode/
is the site dedicated to LiveCode mentioned in the comment above
that you might want to check out!
Tipped
off the following media outlets as to the Kickstarter
http://www.computerworld.dk
http://www.comon.dk
http://www.version2.dk
Hejsa
Her er noget som I evt. kunne tænkes at skrive lidt om.
Indtil for blot et par dage siden havde jeg ikke hørt om
LiveCode, men så faldt jeg over en artikkel om transition fra
closed source til Open Source
http://www.networkworld.com/community/blog/can-clo…
Åbenbart så er RunRev i gang med en Kickstarter, der går ud på
at udgive softwaren som tidligere var closed source ud som GPL3,
hvis deres Kickstarter er successfuld.
Du kan finde selve Kickstarteren her: http://www.kickstarter.com/projects/1755283828/ope…
Jeg kendte ikke LiveCode platformen, men kunne ikke efter at
have set deres promo lade være med at downloade deres 60 dages
demo til Linux.
Jeg har siddet og leget lidt og det er faktisk interessant hvad
man kan flikke sammen uden det store forhåndskendskab, flytbare
knapper, colission detection, billedvisning etc. og det med
kommandoer så forståelige som
En flytbar knap
on mouseDown grab target
end mouseDown
Eller simpel colission detect
if intersect( img "billede1" , img "billede2") then
< GØR ET ELLER ANDET > F.eks set the loc of img "billede1" to 50, 50
end if
Ville flytte billede 1 til 50,50 såfremt det rammer billede2 -
Kunne være hvilken som helst anden funktionalitet.
Det der især tiltaler mig ved LiveCode Kickstarteren er at de
har et udviklingsværktøj som du kan lave cross platform
kompilering til og som de vil gøre tilgængelig under GPL3.
Umiddelbart synes miljøet lynhurtigt at lære og syntax
strukturen simplere end f.eks. Java eller Javascript det er lidt
svært at vænne sig til ikke at skulle skrive alenlange sætninger
:)
Jeg kunne derfor ikke lade være med at tegne mig som pledger af
principielle årsager - Synes det er enormt fantastisk at se
udviklingsværktøjer som dette blive released som GPL3.
Det synes Steve Wozniak og Cory Doctorow åbenbart også og de har
også tegnet sig for hver deres pledge og når “respektable”
folksom disse tegner sig som pledgers så er projektet nok heller
ikke helt ved siden af.
Jeg kunne godt tænke mig at høre …… læseres mening er der andre
her som af principielle årsager kunne finde på at pledge til et
sådant projekt eller er det helt hen i vejret at tænke således
efter jeres mening ?
Other
media outlets tipped off regarding Kickstarter Campaign
Geekosystem *
TechCrunch *
Techradar *
Huffington Post UK *
NewRisingMedia *
The Register *
Slate *
TrendHunter *
http://www.kickstarter.com/projects/461687407/kickstarter-open-source-death-star
I understand we're going to use OpenSource hard and software to
build this thing.
So how about making things easy for ourself +
we could use the near human language programming environment
LiveCode that is on it's way to come under a GPL3 license as you
can see here http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode
- The development enwironment will enable us to create super
cool screen displays, we will be able to deploy our code across
a whole slew of operating systems both desktop as well as mobile
and we only need to write the code once… now that is a boon
since there will likely be a lot of different units running
loads of different operating systems all over the station…
Also collission detection is extremely easy with this
environment and can when the environment is Open Sourced
undoubtably be extended to cover both Asteroids as well as
proton torpedoes…
What say you are you with me ?
I've been trying out LiveCode for an application to train
dexterity and logical thinking for aphasia and stroke victims.
With no prior knowledge, in less than 14 days, only dabbling
from a couple of minutes to a couple of hours per day, even
interrupted for several whole days, I have been able to create
the basis needed for said application. The LiveCode Environment
is a write once deploy to many Operating System OS/mobile
platforms system, making it very interesting and I recommend you
to try it.