Search found 89 matches

by rkriesel
Wed Jan 13, 2021 9:03 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: building an answer string programmatically
Replies: 19
Views: 1632

Re: building an answer string programmatically

Hi, Bruce. Here's a way to invoke "answer" with multiple options, each with multiple words. command answerViaParams pPrompt, pOptions get "answer" & quote & pPrompt & quote && "with" && quote & item 1 of pOptions & quote repeat for each item tOption in item 2 to -1 of pOptions get it & " or " & quot...
by rkriesel
Wed Jan 06, 2021 3:29 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Getting the numeric month from the month name
Replies: 7
Views: 1052

Re: Getting the numeric month from the month name

Hi, Michael. How about one line?
get lineOffset(tMonth, the abbr monthNames)
-- Dick
by rkriesel
Tue Sep 15, 2020 1:59 am
Forum: Engine Contributors
Topic: the microseconds
Replies: 21
Views: 4221

Re: the microseconds

Hi, Mark. I share the motivation, but satisfy it with "the long milliseconds," which distinguishes nanoseconds. That maximizes precision, and, with enough test results and additional measures ( median, standard deviation, and many more), accuracy beyond milliseconds. (Disclaimer: I'm not a statistic...
by rkriesel
Fri Sep 11, 2020 12:50 am
Forum: Talking LiveCode
Topic: Separate the interface from running background routines (Solved)
Replies: 13
Views: 2288

Re: Separate the interface from running background routines (Solved)

dunbarx wrote:
Fri Sep 11, 2020 12:36 am
I have always wanted to be able to set the recursion limit.
Hi, Craig. Here's an example from the dictionary:

Code: Select all

set the recursionLimit to 20
-- Dick
by rkriesel
Fri Sep 04, 2020 3:54 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Whole numbers
Replies: 30
Views: 3496

Re: Whole numbers

EddieLee wrote:
Thu Sep 03, 2020 11:53 pm
Is there any livecode function or code that can detect if a variable is a whole number?

Code: Select all

if c is an integer
Hi, Eddie. See "integer" in the dictionary.
-- Dick
by rkriesel
Wed Aug 19, 2020 9:04 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Equivalent of classes in LiveCode
Replies: 152
Views: 21552

Re: Equivalent of classes in LiveCode

Hi, Brian. I like your ".constructor" suggestion for ease of understanding the action. Why exclude "object.constructor" from the action? It could take some of the code from newObject. Or if "object.constructor" doesn't exist, the unhandled dispatch would be harmless. Thanks for sharing your insight....
by rkriesel
Mon Aug 17, 2020 7:42 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Equivalent of classes in LiveCode
Replies: 152
Views: 21552

Re: Equivalent of classes in LiveCode

Here's the latest. Hi, mwieder. Thanks for investing in this effort, and for sharing progress and current challenges. Since constructors and destructors in general need to know what they're working on, and since the target and me don't suffice, handlers newObject and deleteObject can help by passin...
by rkriesel
Thu Aug 13, 2020 6:18 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Equivalent of classes in LiveCode
Replies: 152
Views: 21552

Re: Equivalent of classes in LiveCode

Hi, Bernd. Thanks for the stack. I'm still considering it.

Meanwhile, how about, by convention, passing the object id to every constructor and destructor, instead of relying on "me" to identify the object?

-- Dick
by rkriesel
Wed Aug 12, 2020 3:04 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Equivalent of classes in LiveCode
Replies: 152
Views: 21552

Re: Equivalent of classes in LiveCode

before birth pX, pY, pdX, pdY, pLifeSpan, pParticleSource, pGravity --dispatch "birth" to the behavior of me with px, py, pdX, pdY, pLifeSpan, pParticleSource -- blocked BN if pGravity is empty then set the gravity of me to 1 else set the gravity of me to pGravity end if end birth before animate se...
by rkriesel
Sat Aug 08, 2020 12:16 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Something is not right with my data
Replies: 45
Views: 6552

Re: [SOLVED] Something is not right with my data

put the monthNames into tMonthsArray replace CR with (TAB & CR) in tMonthsArray split tMonthsArray by CR and TAB repeat for each item aMonth in field "Month Data" add 1 to tMonthsArray[ aMonth] end repeat combine tMonthsArray using CR and TAB put tMonthsArray into field "Monthly Counts" Hi, Thierry...
by rkriesel
Wed Aug 05, 2020 7:06 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Something is not right with my data
Replies: 45
Views: 6552

Re: [SOLVED] Something is not right with my data

get it & line i of the monthNames, tCounts[ i ] & cr @dick, should the "it" in that line be an "i"? Hi, Jacque. "it" works here, containing all the lines "it" contained before the statement, and the statement appends another line. The syntax is a compact equivalent of "put <line> & cr after <lines>...
by rkriesel
Wed Aug 05, 2020 6:42 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Something is not right with my data
Replies: 45
Views: 6552

Re: Something is not right with Livecode Strings

In a moment of clarity, I wrote the following code in a new project with nothing loaded: ... It works 100%. ... Hi, karmacomposer. Now that your code works, you might like to simplify it, as a way to learn simpler techniques, and accelerate future coding. Here's a suggestion: function testMonthsAnd...
by rkriesel
Mon Jul 27, 2020 11:16 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: looping through an array of JSON objects
Replies: 4
Views: 926

Re: looping through an array of JSON objects

... on mouseUp put field 1 into tData put JSONToArray(tData) into tArray repeat for each key aKey in tArray if tArray[aKey]["name"] = "max" then put "Max" & cr & tArray[aKey]["number"] into field 2 exit repeat -- just bail out because you have found what you were looking for end repeat end mouseUp ...
by rkriesel
Tue Jul 21, 2020 12:44 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: [SOLVED] Filtering an array...
Replies: 11
Views: 1956

Re: Filtering an array...

... repeat for each key tKey in tArray if tArray[tKey]["abc"] = "xyz" then put tArray[tKey] into tSelected[tKey] end repeat ... results in tSelected having non-contiguous numeric keys in the first dimension ... That can be shorter and faster without the repeat loop: filter elements of tArray where ...
by rkriesel
Thu Apr 09, 2020 10:15 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Combination of list of word
Replies: 3
Views: 909

Re: Combination of list of word

18 words per sequence
18! sequences
5 bits per word (minimum to distinguish 18 individuals)
a billion bytes per gigabyte
~= 70 million gigabytes in your one file

You can be very sure, as you say, "there will be problems to do it."
-- Dick

Go to advanced search