Jump to content




[Lua] [Solved] Variable Room weird movements


  • You cannot reply to this topic
4 replies to this topic

#1 valithor

  • Members
  • 1,053 posts

Posted 05 June 2013 - 10:49 PM

So i created a short program to test out a couple of file sharing functions i have created. This program will dig a x amount of blocks in width, z in length, and y in height. While it is digging it will save all of its coords when moving with its starting point being 0, 0 ,0 facing 0 (north). The program begins in the top right corner of the area you wish to clear. My problem is somewhere in the banking command and after about a hour of trying to find the error i have given up completely stumped. What it does is it banks what it has then will return to the location it was before it banked. It then will get stuck going forward after it has returned to its position before banking. I can not locate why it does this. I get no error message. From what i can tell if i let it it would go until it went into a unloaded chunk.


code:
Spoiler

http://pastebin.com/a1ci8vVP

Thank you for your time

Edited by valithor, 06 June 2013 - 12:47 AM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 June 2013 - 11:04 PM

In eg your "backoldx()" function (line 330), you have a while block that looks like this:

    while x~=oldx do
      forward()
      readsave()
    end

Go take a look at what the "readsave()" function is doing and you'll see why the turtle never stops. A quick guess tells me you wanted to call "save()" instead.

This is not the only spot you appear to've made this error.

#3 valithor

  • Members
  • 1,053 posts

Posted 05 June 2013 - 11:26 PM

From what i can tell the only part of the back functions that don't work is the backoldz() function. Both of the other functions return the turtle to the correct coordinates and are basically exact copies of each other

I tested the turtle again to return accurate information

The coordinate folder that the program makes starts out as
Spoiler


What is turns out as when i speed up the banking function is
Spoiler

in every test i have the only back command that messes up is the backoldz() function

The fact that only the one function messes up is what confuses me

#4 valithor

  • Members
  • 1,053 posts

Posted 06 June 2013 - 12:05 AM

I have found the problem after some more testing with the script the actual error is coming from this function
Spoiler

The banking function will finish then what happens is the forward function repeats itself i have slightly edited it in a attempt to remove this error but it has not worked

here is the edited code
Spoiler

This did not work will continue to try but a help is appreciated

#5 valithor

  • Members
  • 1,053 posts

Posted 06 June 2013 - 12:47 AM

I finally found the problem after about another 2 hours of messing with it
Spoiler

on that part of code i ended the if loop to early it should have ended after the back functions

Spoiler






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users