time and tables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

time and tables

Post by smash » Sun Nov 08, 2009 10:11 pm

ok, this is all about equestrian dressage.
i need to workout, how to put riders into the draw on several different horses, in several different tests, at several different times.
this is my times button script (you have a field for start time, finish times, the time luch starts, and for how long lunch goes for)
on mouseUp
local tStartTime, tEndTime

--clear the field
put empty into field "Time1"

--get the first session time limits
put field "StartTime" into tStartTime
put field "LunchTime" into tEndTime

--if there is a lunchbreak specified
if tEndTime is not empty then

--fetch the entry times list by calling the function
--and telling it what the start and end time limits are
put fnGetEntriesList (tStartTime, tEndTime) into field "Time1"

--then work out how long the lunch break is
--and make a new start and stop time range
put field "LunchTime" into tStartTime

--dateItems are a comma delimited list of year, month, day, hour, minute, second, day of week
convert tStartTime to dateItems

--so the fourth in the list is hours
add field "LunchLength" to item 5 of tStartTime
--convert it back to a meaningful time
convert tStartTime to short time
--get the last entry time for the afternoon session
put field "LastEntry" into tEndTime

--call the function again with the new range for the
--afternoon session
put fnGetEntriesList (tStartTime, tEndTime) after field "Time1"

--if there wasn't a lunchbreak then go straight through from
--start to finish
else
put field "LastEntry" into tEndTime
--fetch the entries list by passing the start and stop
--times to the function
put fnGetEntriesList (tStartTime, tEndTime) into field "Time1"

end if
end mouseUp

function fnGetEntriesList pStartTime, pEndTime
local tEntriesList
--do some basic checking
put fnCheckValidTime (pStartTime) into pStartTime
put fnCheckValidTime (pEndTime) into pEndTime

--the checking function returns the time converted
--to seconds, so that it is easy to tell when it is more
--than the end time
repeat while pStartTime < pEndTime

--convert it back to something we can use in the field
convert pStartTime to short time
put pStartTime & cr after tEntriesList

--convert it back to that comma delimited list
--so that it is easy to add on 8 minutes
convert pStartTime to dateItems
add 8 to item 5 of pStartTime

--convert it back to seconds so that the loop
--can tell when the end time is exceeded
convert pStartTime to seconds

--go back and do it again (as long as the end time is not exceeded)
end repeat

--send back the list of entry times to be put into the field for viewing
return tEntriesList
end fnGetEntriesList

function fnCheckValidTime pTime
--this checks that each value given to it
--can be interpreted as a time
--and converts it to seconds for
--easy mathematical comparison
convert pTime to seconds
if pTime is not a date then
answer error "Check the times have been input correctly"
exit to top
else
return pTime
end if
end fnCheckValidTime
the time sequence is on each of the 60 cards

on the opening card, i have where you enter all the competitors details, name, horses name, and what tests they are doing. you enter all details, and tick the check boxes of the different tests.

i have over 60 check boxes, with this script
on mouseUp


local theCardName
if the hilite of me is true then

put "Entries" into theCardName
put the label of me after theCardName



if (field "HorsesName" is not empty) and (field "RidersName" is not empty) then
put field "BridleNumber" & tab & field "HorsesName" & tab & field "RidersName" & return after field "Entries" of card "Entries1"

else
answer "You have not completed the entry details correctly"
end if

end if

end mouseUp
so for this script, the "Entries1" changes all the way upto "Entries60".

now the problem i am having, is working out how to do this. (this is so hard to explain sorry)
so i enter the details, and the rider and horse are put into the first available row in each selected test.
now this means, they are riding the one horse at the same TIME in all five tests (which of course is impossible to do)
so how do work out, that they go into different tests at different times ??
now my other problem is.
one rider may have 2 different horses (or more), so how do i get the link, so the riders name is also acknowledged ??


example
jodie foster, riding blacky in test P1, P2, P.1 and P,2
jodie foster, riding whitey in test P.1, P.2, N.1 and N.2
how can i enter them so they go into these tests, 1 hour apart, throughout all tests.

most likely lost you by now havnt i sturgis ???

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Post by sturgis » Sun Nov 08, 2009 10:49 pm

Yep, completely lost, but i'll read through it a few times and see if I can't get enough understood to possibly help.

Any chance you could post your current stack, or even screenies of what you have so far so I can get a visual clue as to what you're attempting?

I think i'm close, and have an inkling of an idea, but more information is always a good thing.

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Sun Nov 08, 2009 11:52 pm

not sure how to post them on here,
but will try
nope, it will not work ??
can email them to you, to give you more of a visual ??


it is just so hard to explain in writting
but thank you for your time sturgis

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Post by sturgis » Mon Nov 09, 2009 12:17 am

I avoid posting my email in forums.. If you have a twitter account you could use twitpics to post any screenshots you have, then post the image urls here.
smash wrote:not sure how to post them on here,
but will try
nope, it will not work ??
can email them to you, to give you more of a visual ??


it is just so hard to explain in writting
but thank you for your time sturgis

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Mon Nov 09, 2009 3:30 am

i dont have a twitter account (actually never heard of it) :oops: :oops:
but i have no problems giving my email out to you
performancepintos@gmail.com
and if you like, i will just reply, via email my, stack to you, and you may put it up on here if you like.
i have tried several different ways, and nothing seems to work at posting my stack ????
sorry i just dont know another way, to get the "visual" to to you.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Mon Nov 09, 2009 10:14 am

I've already got some work in progress on this for you smash ;-)

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Post by sturgis » Mon Nov 09, 2009 3:22 pm

Oh cool, with Spark helping you, you're in great hands. May go ahead and mess with this anyway, but Spark is awesome and will have a beautiful solution for you.
SparkOut wrote:I've already got some work in progress on this for you smash ;-)

smash
Posts: 99
Joined: Tue Aug 19, 2008 5:18 am

Post by smash » Mon Nov 09, 2009 10:11 pm

sparky is just the best, just think the world of him
but sturgis, please play away, there are just so many ideas or ways to do things, and fresh ideas are always inspiring.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Tue Nov 10, 2009 12:05 pm

Ooo wow, er, shucks, thanks :oops:
By all means go ahead and mess sturgis, it's always good to see another take on a solution to a problem. It's also the way I learn best myself - helping others and examining what other people are doing to help too. The stack smash is talking about might not look quite the same when she gets it back from me though, that's all. Considering what she knew when she started this thing though, she's come a very long way.
And I think the world of her too.

Post Reply