Author Topic: Displaying only a portion of a string?  (Read 2593 times)

0 Members and 1 Guest are viewing this topic.

Offline awalden0808

  • LV3 Member (Next: 100)
  • ***
  • Posts: 55
  • Rating: +6/-0
  • Cool shades, wears Waldo.
    • View Profile
Displaying only a portion of a string?
« on: February 02, 2013, 03:38:53 pm »
So, I have two appvars. One contains a long string of words - a string of strings. The other contains, in order, the location of each string relative to the string appvar's pointer. How can I display one of those strings if I have where its first letter is and where its last letter is? I'm having trouble with this...
I'll apologize tomorrow for a bad mood today.

Spoiler For Spoiler:
My Qualifications:

I did a thing once.
I am known for my ability to focus intently on things that distract me from my actual work.
To me, the letter a stands for absolute. B stands for bemusement. C stands for circumlocution, and D stands for decoupage.
If I were president, I would give everyone Xboxes, computers, and national healthcare.
I am also known for my ability to write more than I actually need to write. Unless of course it is necessary that I write a lot. Then I write a little bit.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Displaying only a portion of a string?
« Reply #1 on: February 02, 2013, 03:57:03 pm »
As you describe it, it seems that you only can use a custom text routine. Let's say that S is the offset to the starting letter, E the offset to the ending letter and A the address of your appvar :
Code: [Select]
:While S<E
:Disp {A+S}>Char
:S++
:End
Of course, it can be optimized.

EDIT : I don't remember if this automatically goes to the next line if the right of the screen is reach ...
« Last Edit: February 02, 2013, 03:57:46 pm by Matrefeytontias »

Offline awalden0808

  • LV3 Member (Next: 100)
  • ***
  • Posts: 55
  • Rating: +6/-0
  • Cool shades, wears Waldo.
    • View Profile
Re: Displaying only a portion of a string?
« Reply #2 on: February 02, 2013, 04:00:05 pm »
As you describe it, it seems that you only can use a custom text routine. Let's say that S is the offset to the starting letter, E the offset to the ending letter and A the address of your appvar :
Code: [Select]
:While S<E
:Disp {A+S}>Char
:S++
:End
Of course, it can be optimized.

EDIT : I don't remember if this automatically goes to the next line if the right of the screen is reach ...
I did this, but it wasn't working... Maybe my files were corrupt or something. Something happened, because I checked the source file and the strings actually appeared in the source file, when they should only be in the appvar... I'm gonna clean things up again and see if I can get this to work.

And so I don't lose anything, I'll use Wabbit and TokenIDE instead of trying to manage with the calc.
« Last Edit: February 02, 2013, 04:04:02 pm by awalden0808 »
I'll apologize tomorrow for a bad mood today.

Spoiler For Spoiler:
My Qualifications:

I did a thing once.
I am known for my ability to focus intently on things that distract me from my actual work.
To me, the letter a stands for absolute. B stands for bemusement. C stands for circumlocution, and D stands for decoupage.
If I were president, I would give everyone Xboxes, computers, and national healthcare.
I am also known for my ability to write more than I actually need to write. Unless of course it is necessary that I write a lot. Then I write a little bit.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Displaying only a portion of a string?
« Reply #3 on: February 02, 2013, 08:08:03 pm »
Can you put a null terminator at the end of every word/string unit (like was just recently brought up here and here)? If each small piece ended in a null byte, then you could display each one just like a normal string, given the pointer to its start.

If speed is not of huge importance, you would also then have the option of using stdDev() to get the pointer to individual strings given their index in the "list" of strings. Not sure if that would make it easier or harder for you, but you would have the option.
« Last Edit: February 02, 2013, 08:09:41 pm by Runer112 »