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).
I don't know about fixing your problem, but I did optimize your code a bit Smile


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
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?
Why would you be against the use of Ans? Do you not like good code or something?
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.
I got the impression of him being against using Ans in general, not just for this. Maybe (probably) I was wrong though.
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.
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.
Okay. I didn't see the topic when I wrote my post, so sorry.
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.
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement