Case thyme structure

About advanced scenes, and the Thyme scripting language used in Algodoo.

Case thyme structure

Postby Kilinich » Mon Dec 15, 2014 1:19 am

Sometimes you need to run few different lines of code depends on condition. Usually we add few IF -THEN - ELSE statements, but there is a better way to use case-alike code:
Code: Select all
[{code1},{code2},{code3}](index)()

should do the trick!
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Case thyme structure

Postby icrls984 » Mon May 11, 2015 4:49 am

Sorry for my noobiness, but what does the index do? Can you show me an example? I'm so bad at thyme sooo... :crazy:
.
User avatar
icrls984
 
Posts: 80
Joined: Thu Jun 13, 2013 6:33 am

Re: Case thyme structure

Postby FRA32 » Sun Aug 09, 2015 1:42 pm

the index is a number to specify which code gets executed, so if it says 0 it should execute code #1, if it says 3 it executes code #4 (because 0 is always the first object)
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron