Page 1 of 1

word among the item?(Solved)

Posted: Sat Apr 04, 2015 11:18 pm
by vedus
Maybe is easy but still i can find the how to :(.
i have the bellow code
the tNumber get some numbers from 1 to 15

Code: Select all

1:)if tNumber contains "1" then
2:)do something
3:)else if tNumber contains "3" then
4:)do something
5:)else if tNumber "10" then
6: do something
7:end if
the loop restart from line 1 when is on line 3
because "1" and "10" is the same
how can override this behavior ?

Re: word among the item?

Posted: Sun Apr 05, 2015 12:18 am
by SparkOut
I am really not sure what you are trying to do, and how your string of numbers in tNumber looks, but...
try going through the checks in order from more specific to general

Code: Select all

if tNumber is "10" then
  doTenThing
else if tNumber contains "1" then
   doOneThing
else if tNumber contains "3" then
   doThreeThing
end if

Re: word among the item?

Posted: Sun Apr 05, 2015 12:19 am
by Newbie4
The simplest way to fix this - is to check for the '10' before you check for the "1"

Code: Select all

if tNumber contains "10" then
     do something
else if tNumber contains "3" then
     do something
else if tNumber "1" then
     do something
end if
Do the same for 11, 12,13,14, and 15

Re: word among the item?

Posted: Sun Apr 05, 2015 11:26 am
by vedus
Thank you Sparkout & Newbie4.
I am really not sure what you are trying to do, and how your string of numbers in tNumber looks, but...
The numbers is the first digit from the Hour in 24 format and exist in the fields.
The problem i try to solve is, from 19:00 until 7:00 i need to put the Night images and the rest from 8:00 to 18:00 the Day.

Re: word among the item?

Posted: Sun Apr 05, 2015 11:54 am
by Dixie
The numbers is the first digit from the Hour in 24 format and exist in the fields.
The problem i try to solve is, from 19:00 until 7:00 i need to put the Night images and the rest from 8:00 to 18:00 the Day.

Code: Select all

on mouseUp
   put the seconds into tday
   convert tday to dateitems
   
   if item 4 of tday >= 0 and item 4 of tday < 8 then
      --go do night time stuff
   end if
   
   if item 4 of tday >= 8 AND item 4 of tday <= 18 then
      -- go do day time stuff
   end if
   
   if item 4 of tday >= 19 AND item 4 of tday <= 23 then
      --go do night time stuff
   end if
end mouseUp

Re: word among the item?

Posted: Sun Apr 05, 2015 5:39 pm
by vedus
Dixie wrote:
The numbers is the first digit from the Hour in 24 format and exist in the fields.
The problem i try to solve is, from 19:00 until 7:00 i need to put the Night images and the rest from 8:00 to 18:00 the Day.

Code: Select all

on mouseUp
   put the seconds into tday
   convert tday to dateitems
   
   if item 4 of tay >= 0 and item 4 of tday < 8 then
      --go do night time stuff
   end if
   
   if item 4 of tday >= 8 AND item 4 of tday <= 18 then
      -- go do day time stuff
   end if
   
   if item 4 of tday >= 19 AND item 4 of tday <= 23 then
      --go do night time stuff
   end if
end mouseUp
Thank you Dixie.That solve my problem permanently ;)