Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: nathanpc on September 07, 2010, 08:54:42 am

Title: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 08:54:42 am
Hello,
 I'm learning TI-BASIC and I want to do this(here is pseudo-code):
Code: [Select]
: ClrHome
: For(...)
: Output(3,1,"WELCOME")
: End
: For(...)
: Output(4,2,"TO THE")
: End
: For(...)
: Output(5,3,"TI WORLD!")
: End
But how I can use FOR to display that when passed 1 second(for the first one) and 500ms for the others?

Best Regards,
 Nathan Paulino Campos
Title: Re: Using For To Wait For Output
Post by: Raylin on September 07, 2010, 09:25:09 am
Use rand(X) where X is a number that will give you the desired length. (positive integer only)

Also, welcome to Omnimaga! :)
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 09:58:40 am
Thanks very much for the welcome! But how I could put the RAND command on my source. Because I can't see anything like it on the Prgm menu. :(

Best Regards
Title: Re: Using For To Wait For Output
Post by: Raylin on September 07, 2010, 10:03:32 am
rand is a MATH function. You can find it either using the Catalog which is [2ND][0] or [MATH][<].
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 10:12:27 am
Thanks very much! It works, but let me guess one thing: rand(100) will be the same of 1 second?
Also, when I put rand(1000) it gave me an error saying: "Invalid Dim"
Title: Re: Using For To Wait For Output
Post by: Raylin on September 07, 2010, 10:35:55 am
You can't put rand(1000) because the OS can only have a maximum of 999 elements in a list.
Since this is the case, one can't put 1000.
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 10:45:58 am
So if I want a 10 seconds wait I just need to do something like
Code: [Select]
rand(500)
rand(500)
More Code...
This will have the same effect of rand(1000). Correct?
Title: Re: Using For To Wait For Output
Post by: Raylin on September 07, 2010, 11:04:46 am
Yep. :)
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 11:10:11 am
Wonderful! Thanks very much for your help! :)
Title: Re: Using For To Wait For Output
Post by: Raylin on September 07, 2010, 11:19:57 am
No problem. :)
Title: Re: Using For To Wait For Output
Post by: DJ Omnimaga on September 07, 2010, 12:39:39 pm
Hi and welcome here Nathanpc! Good luck learning TI-BASIC and your future programming projects :)
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 12:48:16 pm
Thanks very much. I'm learning TI-BASIC to understand better how the machine works. Then my goal is set to learn some of z80 Assembly. Since I'm an Assembly Guy, that know x86, 8086, 6502, MIPS and the painful ARM Assembly. :)
Title: Re: Using For To Wait For Output
Post by: calc84maniac on September 07, 2010, 01:23:15 pm
Thanks very much. I'm learning TI-BASIC to understand better how the machine works. Then my goal is set to learn some of z80 Assembly. Since I'm an Assembly Guy, that know x86, 8086, 6502, MIPS and the painful ARM Assembly. :)
Don't diss the ARM assembly :P
Title: Re: Using For To Wait For Output
Post by: DJ Omnimaga on September 07, 2010, 02:00:15 pm
But ARM ASM seems really cool, especially for the Nspire D:

I understand learning ASM can be much harder for some people, though. I think it may be due to how certain tutorials (such as 28 days) are written, though. People who are visual may have an hard time learning ASM by relying only on it.
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 02:03:02 pm
Thanks very much. I'm learning TI-BASIC to understand better how the machine works. Then my goal is set to learn some of z80 Assembly. Since I'm an Assembly Guy, that know x86, 8086, 6502, MIPS and the painful ARM Assembly. :)
Don't diss the ARM assembly :P
I've just said that is very difficult, I'm not dissing any language. Sorry about my bad english.
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 02:06:09 pm
But ARM ASM seems really cool, especially for the Nspire D:

I understand learning ASM can be much harder for some people, though. I think it may be due to how certain tutorials (such as 28 days) are written, though. People who are visual may have an hard time learning ASM by relying only on it.
Because of this that I like to learn BASIC before learning Assembly for a machine. To learn more about the machine before getting it on the world of Assembly. This is what I've done for all the other Assembly languages(see my signature) and it works very nice. ;)
Title: Re: Using For To Wait For Output
Post by: DJ Omnimaga on September 07, 2010, 02:12:21 pm
No problem. One thing, though, when quoting messages you can quote multiple ones at once, so you can post the replies in one post. Just wanted to let you know. ;)

As for ASM I agree. I think some tutorials states that you need to know one language like that or C before attempting ASM, so you learn some programming concepts. It's good to have some other knowledge besides BASIC too but it's not necessary. In my case, I know TI-BASIC and Axe Parser for the TI-83+/84+. Axe is a bit like BASIC but it also deals with a few low-level stuff like pointers and memory addresses

EDIT: Also english is not my native language either. Don't worry too much about it :)
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 04:25:28 pm
Ok, I'm familiar with forum boards, since I'm a moderator at a big mobile device/GPS community(as I'm a Windows Mobile and TomTom expert). That was just because I was needing to post it faster as I was going to lunch. Sorry. :)

Also, I loved your explanation about my method of learning.
Title: Re: Using For To Wait For Output
Post by: DJ Omnimaga on September 07, 2010, 04:34:55 pm
Ah ok I was not sure, because there are boards, especially those that looks like Wikidot forums, Ticalc.org comment boards or Slashdot, where the forum system makes it inevitable double-posting will occur, and some people are used to those boards more than the regular ones. In other cases, sometimes people internet is slower and when clicking submit, nothing happens so they click again and again x.x
Title: Re: Using For To Wait For Output
Post by: nathanpc on September 07, 2010, 05:15:33 pm
The board that I'm from the staff is a phpBB ;)
Title: Re: Using For To Wait For Output
Post by: meishe91 on September 07, 2010, 05:37:46 pm
So if I want a 10 seconds wait I just need to do something like
Code: [Select]
rand(500)
rand(500)
More Code...
This will have the same effect of rand(1000). Correct?

Just so you know, it might be better to just put rand(999. That way you save five bytes and there is only a very, very, small difference between the length of time.

Welcome to Omnimaga, by the way :)