Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

TI-Basic => TI-BASIC
Author Message
tifreak8x

Elite

Joined: 27 Aug 2005
Posts: 956

 Posted: 18 Feb 2006 07:06:59 am    Post subject: What I am doing is placing a number, 1000000000, in a list slot, and I need to extract just one digit from it. I would like to use this as a flag system for my project... Anyways, Basically I need to check the 5th digit of the list slot, or variable. Elfprince gave me this: Quote:here is some pseudo code to extract a stat from a complex number assuming that all stats other than HP max out at 100. note that I am using (L) to represent the little L CODE //storing code [def](100^5)+[atk](100^4)+[spec](100^3)......+[hp]i->(L)PKMST(34) //extract atk 4->I //atk has index 4...see above (L)PKMST(34)->D iPart(D/(100^(I-1->D (100)fPart(D/(100^I->D Text(1,1,"Atk = ",D Text(10,1,"HP = ",imag((L)PKMST(34) But what I am needing, like I stated, was just the one digit, to see if it is 0, 1, or 2. I don't know if this is possible, but I sure hope it is...
Jacobbus

Member

Joined: 20 Aug 2005
Posts: 106

 Posted: 18 Feb 2006 11:23:44 am    Post subject: wel after some thinking I found a way, but it isn't a verry ellegant way. and your graphscreen is cleared. Code: ```:ClrDraw :A/1000000->B  ;A=the value right from the list :Text(0,0,B :(pxl-Test(1,18)=1)+(pxl-Test(1,18)=1)->X  ;X=0 or 1 or 2``` of course you may use other variables. basicaly what you're doing here is display the number and than look what it is, I know it is very dumb but I couldn't find a matamatical way of doing this. maybe you can store this bit in someother variable so you don't need to do this whole drawing piece. and if you realy want to save your grahpscreen you can alwas store it in a picture but that would make it realy slow. so it is possible as you see, but not verry nice.Last edited by Guest on 18 Feb 2006 11:26:10 am; edited 1 time in total
leofox
INF student

Super Elite (Last Title)

Joined: 11 Apr 2004
Posts: 3562

 Posted: 18 Feb 2006 11:59:16 am    Post subject: supergoose made something that lets you do that. try to look for it
tifreak8x

Elite

Joined: 27 Aug 2005
Posts: 956

 Posted: 18 Feb 2006 12:04:42 pm    Post subject: 0x5, he seems to solve all kinds of problems. I would grow old looking for it... :0x5: I will make the attempt to find it later if he doesn't post it first...
DarkerLine
ceci n'est pas une |

Super Elite (Last Title)

Joined: 04 Nov 2003
Posts: 8328

 Posted: 18 Feb 2006 01:11:53 pm    Post subject: to select a specific digit D (counting from the right starting at 1): iPart(10fPart(X10^(-D To convert a number X into a list of its digits in base 10: int(10fPart(Xseq(10^(I-1),I,-int(log(X)),0 In both of these examples, use the 10^( token instead of writing it out. Also, see this postLast edited by Guest on 18 Aug 2008 07:17:55 pm; edited 1 time in total
tifreak8x

Elite

Joined: 27 Aug 2005
Posts: 956

 Posted: 18 Feb 2006 01:29:38 pm    Post subject: Thank you, I will try it out.
Weregoose
Authentic INTJ

Super Elite (Last Title)

Joined: 25 Nov 2004
Posts: 3976

 Posted: 18 Feb 2006 05:16:04 pm    Post subject: I'm glad DarkerLine got to this first, else I would probably have written my program without remembering the specified single digit. Mine is more weighty, but extracts entire subsets rather than individual numbers. You can find that on my website (near the bottom of my routines page, as it stands currently).
 Display posts from previous: All Posts Oldest FirstNewest First
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
 Page 1 of 1 » All times are GMT - 5 Hours