CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 117 users online: 2 members, 90 guests and 25 bots.
Members: geekboy1011.
Bots: MSN/Bing (2), Magpie Crawler (3), Googlebot (19), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
    » Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
» View previous topic :: View next topic  
Author Message
Dr Phil


Newbie


Joined: 17 Sep 2011
Posts: 35
Location: Sweden

Posted: 30 Sep 2011 07:15:24 am    Post subject:

I'm no expert, but it should be quite obvious that your program isn't working. The "" command returns a pointer to the place where your string is saved, it does not return the values of the characters in the string.

To get your program to work, either use the byte value of the letter (A=65, B=66 and so on) or use {"E"}. There might be a smarter way, but not what I know of.
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 30 Sep 2011 07:19:18 am    Post subject:

it still doesn't work........
_________________



Back to top
Dr Phil


Newbie


Joined: 17 Sep 2011
Posts: 35
Location: Sweden

Posted: 30 Sep 2011 07:22:35 am    Post subject:

Then you are typing something wrong. This code works perfectly for me:


Code:
.TST
"HELLO WORLD"→Str1
Text(0,0,inData({"W"},Str1)▶Dec)
Pause 1000
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 30 Sep 2011 07:28:02 am    Post subject:

I didn't have the curled brackets! That's it! Thanks a lot!
_________________



Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 30 Sep 2011 09:04:01 am    Post subject:

I got another question...... Can you make somehow If Str1="T"? That doesn't work...... if you put curly brackets around "T" it still doesn't work. Can you do that somehow?
_________________



Back to top
Dr Phil


Newbie


Joined: 17 Sep 2011
Posts: 35
Location: Sweden

Posted: 30 Sep 2011 09:06:35 am    Post subject:

What is it you want to check? If the first character in Str1 is "T"? Then I think it'll be:
Code:
If {Str1}={"T"}
but I haven't tested it.
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 30 Sep 2011 09:10:22 am    Post subject:

That works, thanks. I don't really get when you have to use curled brackets and when not. Can someone please explain me?
EDIT: oh no, it doesn't work! I have

Code:
:"Blah Blah Blah Blah Blah Blah"->M
:16->D
:Repeat {L1}={" "}
:Copy(M+D,L1,1
:D-1->D
:End
:Copy(M,L1,D
:Text(1,1,L1

It displays Blah Blah Blah B but it should display Blah Blah Blah.
_________________



Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 30 Sep 2011 09:17:39 am    Post subject:

String manipulation with Axe is much more complicated than with TI-Basic. For beginners, pick another project.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
Dr Phil


Newbie


Joined: 17 Sep 2011
Posts: 35
Location: Sweden

Posted: 30 Sep 2011 09:18:26 am    Post subject:

You have to use curly brackets when you are dereferencing a pointer.
For example, when you make a string like this:

Code:
"Hello world"→Str1
then Str1 is a pointer to a part of the RAM where the actual data is stored. That means Str1 is just a number, the addressnumber of the memory location where your string is stored.

If you do

Code:
If Str1="T"
then you'll be comparing two addresses, not the data at the addresses. The curly brackets dereferences the pointer, (grabbing the data the pointer points to) so that you are comparing data instead of addresses.

If you are not understanding pointers, try to read some tutorial on the net. Pointers is quite common in most languages, especially low-level languages.
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 30 Sep 2011 09:24:04 am    Post subject:

Could you maybe please just tell me how I would have to do that code, because it is the only string manipulation I think I need for my program? Or could you maybe please link a tutorial, I couldn't find one on omnimaga. :S
_________________



Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 30 Sep 2011 02:10:58 pm    Post subject:

Dr Phil wrote:
What is it you want to check? If the first character in Str1 is "T"? Then I think it'll be:
Code:
If {Str1}={"T"}
but I haven't tested it.


I can tell you haven't tested it. That wouldn't work; you're comparing the pointer of a one-char string to the value of the first byte of a string. If you want to directly test against char values, use single quotations, like 'T'.
_________________
-Ashbad
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 30 Sep 2011 03:26:30 pm    Post subject:

It works now....Sorry if I was confusing you guys....it truly is FARmore complicated than TI-BASIC. Smile
_________________



Back to top
Deep Thought


Expert


Joined: 11 Mar 2010
Posts: 739
Location: The Universe

Posted: 30 Sep 2011 03:30:55 pm    Post subject:

Axe 1.0.0 and above have an Equ>String() command that does string comparison. Look in the updated Axe Commands list for more information.
_________________
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 30 Sep 2011 03:33:14 pm    Post subject:

Deep Thought wrote:
Axe 1.0.0 and above have an Equ>String() command that does string comparison. Look in the updated Axe Commands list for more information.


Testing for one character puts it to shame. For testing one character like he was showing, checking the first pointed to value against a constant char value is a *lot* more optimized and sane.
_________________
-Ashbad
Back to top
Deep Thought


Expert


Joined: 11 Mar 2010
Posts: 739
Location: The Universe

Posted: 30 Sep 2011 03:35:42 pm    Post subject:

Oh, didn't notice it was a single char. Yeah, testing the char value is a lot better than using the new routine. Ignore my last post Smile
_________________
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 01 Oct 2011 03:24:58 pm    Post subject:

Sorry for this totally noob question.......but I somehow got a black out on one thing, so could someone please just post a example code of it: Drawing 3-level gray scale things to screen and drawing text to screen. it somehow doesn't work if I do <elements> <text>
_________________



Back to top
Dr Phil


Newbie


Joined: 17 Sep 2011
Posts: 35
Location: Sweden

Posted: 01 Oct 2011 03:27:02 pm    Post subject:

Ashbad wrote:
Dr Phil wrote:
What is it you want to check? If the first character in Str1 is "T"? Then I think it'll be:
Code:
If {Str1}={"T"}
but I haven't tested it.


I can tell you haven't tested it. That wouldn't work; you're comparing the pointer of a one-char string to the value of the first byte of a string. If you want to directly test against char values, use single quotations, like 'T'.

Err.. Ashbad, you are the one who has clearly not tested it, it does work as intended. Curly brackets dereferences a pointer. My code would work, and it would be just slightly larger than the correct:

Code:
If {Str1}='T'
Back to top
aeTIos


Power User


Joined: 02 Nov 2010
Posts: 491

Posted: 01 Oct 2011 03:27:51 pm    Post subject:

3 lv gray: pt-on/change/off(HEX)^r
text to buffer:Fix 5: Text(x,y,text) :dispgraph
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 01 Oct 2011 03:32:09 pm    Post subject:

Of course I would never test it. I stopped using Axe a while ago and am proud to have done so. I do see though now, you were correct before; I overlooked the curly brackets, I was on an iPad and with small text things can be hard to see. It isn't however still correct; that method is rather horrible, since it adds 2 bytes to your program each time you test it that way, and many more bytes/cycles for the routine since it has to dereference *and then* compare the value (and make sure that both values are of the same bit-length int size) instead of just comparing to an already-correctly-sized constant value.
_________________
-Ashbad
Back to top
Sorunome


Expert


Joined: 22 Feb 2011
Posts: 636
Location: Somewhere out there

Posted: 02 Oct 2011 01:42:53 am    Post subject:

aeTIos wrote:
3 lv gray: pt-on/change/off(HEX)^r
text to buffer:Fix 5: Text(x,y,text) :dispgraph

I have

Code:
:   *some 3-level Grayscale elements*
:Fix 5
:text, 5,5,"Test"
:DispGraph
:Repeat getKey
:DispGraph^r       //radian "r"
:End

And it doesn't display the text....
_________________



Back to top
Display posts from previous:   
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.

» Go to Registration page
    » Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
» View previous topic :: View next topic  
Page 7 of 9 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.038505 seconds.