| 04 Oct 2007 02:55:16 pm by GenericUser1 |
String problem [Solved (to an extent)] |
Quote |
OK, I have this code:
| Code: |
:¦ If θ=22
:¦ Then
:¦ Output(5,7,"< >
:¦ Repeat Z=22
:¦ ¦ Output(5,8,sub(Str1,G,1
:¦ ¦ getKey→Z
:¦ ¦ Repeat Z
:¦ ¦ ¦ getKey→Z
:¦ ¦ End
:¦ ¦ G-(Z=24 and G≠1)+(Z=26 and G+1≤length(Str1))→G
:¦ ¦ If Z=21
:¦ ¦ sub(Str2,1,F-(5-D)∟EDIT(2)-E-5)+sub(Str1,G,1)+sub(Str2,F-(5-D)∟EDIT(2)-E-3,length(Str2)-length(sub(Str2,1,F-(5-D)∟EDIT(2)-E-3)))→Str2
:¦ End
:End |
And I need it corrected. More specifically the 3rd to last line, teh one with all the sub(s WHat it is suppoesed to do is take the cursor's position (D = UP and Down, E= Left and right), along with the centerpoint (F, should be (5,8) on the screen if you were to plot it, 72 on an 16*8 map), the width of the map (∟EDIT(2)) and the Str2 as the map itself. G is the point in Str1 of which I am trying to move to the point of the cursor. Any one have an idea?
[Edit]
Solved. Figured it out (to an extent). |
| 04 Oct 2007 04:12:35 pm by JoostinOnline |
Re: String problem |
Quote |
I don't know about fixing your problem, but I did optimize your code a bit
| Code: |
:¦ If θ=22
:¦ Then
:¦ Output(5,7,"< >
:¦ Repeat Z=22
:¦ ¦ Output(5,8,sub(Str1,G,1
:¦ ¦ Repeat Ans
:¦ ¦ ¦ getKey
:¦ ¦ End
:¦ ¦Ans→Z
:¦ ¦ G-(Z=24 and G≠1)+(Z=26 and G+1≤length(Str1→G
:¦ ¦ If Z=21
:¦ ¦ sub(Str2,1,F-(5-D)∟EDIT(2)-E-5)+sub(Str1,G,1)+sub(Str2,F-(5-D)∟EDIT(2)-E-3,length(Str2)-length(sub(Str2,1,F-(5-D)∟EDIT(2)-E-3→Str2
:¦ End
:End |
|
| 04 Oct 2007 04:22:00 pm by GenericUser1 |
|
Quote |
I'm not worried about the optimization, I'll do that later when it is complete. I just need to figure out the 3rd line... and how I would change the symbol in the first and last spaces...
And I'm a little against using Ans atm...
I sorta solved it... For some reason, it shows the symbol i just put in on the second line on the first to the right by about 6... I wonder why?
[Edit] Solved completely! Screwed up a + and a - in the output. I'll upload ASAP. Should some sort of open-a-preexisting-map be allowed? |
| 04 Oct 2007 09:56:10 pm by Super Speler |
|
Quote |
| Why would you be against the use of Ans? Do you not like good code or something? |
| 04 Oct 2007 11:16:18 pm by Kllrnohj |
|
Quote |
| Super Speler wrote: |
| Why would you be against the use of Ans? Do you not like good code or something? |
He said "atm" (at the moment) - you never ever optimize something until it works. Also, he may add to it and use what is in ans later, so storing it for now is a good idea. He can always go back and optimize later. |
| 05 Oct 2007 02:17:54 pm by Super Speler |
|
Quote |
| I got the impression of him being against using Ans in general, not just for this. Maybe (probably) I was wrong though. |
| 05 Oct 2007 02:24:29 pm by GenericUser1 |
|
Quote |
Kllrnohj is right, write he code out first and then optomize. I mean, if you optomize while you do it, a) it takes to long and b) if you mess up just a little, it could be problematic.
And for some reason the archives aren't working... My thing won't download. A blank page shows up. |
| 05 Oct 2007 03:36:23 pm by KermMartian |
|
Quote |
| Angel14995 wrote: |
Kllrnohj is right, write he code out first and then optomize. I mean, if you optomize while you do it, a) it takes to long and b) if you mess up just a little, it could be problematic.
And for some reason the archives aren't working... My thing won't download. A blank page shows up. |
There's already a separate topic about it. I'll try to get to it later if I have a chance. |
| 06 Oct 2007 12:40:38 pm by GenericUser1 |
|
Quote |
| Okay. I didn't see the topic when I wrote my post, so sorry. |
| 06 Oct 2007 05:51:47 pm by KermMartian |
|
Quote |
| Angel14995 wrote: |
| Okay. I didn't see the topic when I wrote my post, so sorry. |
No worries. Feel free to keep bumping that other thread if I forget about this. |