Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Harkole

Members
  • Content Count

    12
  • Joined

  • Last visited

  • Days Won

    2

Harkole last won the day on May 18 2023

Harkole had the most liked content!

About Harkole

  • Rank
    Junior Member

Profile Information

  • Gender
    Male
  • Location
    UK

Recent Profile Visitors

996 profile views
  1. Some real interesting answers here, sorry I wasn't more help!
  2. The only thing I can suggest at the moment is to extend your sleep time, it's not exactly accurate and short sleep times maybe missed, try increasing it to 10 or something longer than 3 at any rate and see if it works then.
  3. Hey Ash, The nil result suggests the robot failed to move for some reason, the explanation of move from the Robot API reads: I've not done anything with Robots yet so Molinko maybe a better person to help you, but in an attempt to keep you moving forward with your problem, I think it's returning "nil" because it can't move, it maybe worth catching the second returned value and checking if it has a value? -- catch movement errors success, reason = robot.back() -- debug output if(success) then print("I moved back") else print("I can't move because "..reason) end Hope that he
  4. I like being wrong, point one is a mute thing because I found this in the Wiki: http://ocdoc.cil.li/item:navigation_upgrade This will get your position and also direction of facing from the robot, it's limitation is that it needs a map and only works if the robot is within the bounds of that map.
  5. You have a couple of problems here, the first isn't a major but worth noting: 1. Without cheating this will only work in creative (debug card is not available to craft so you can't get the world co-ordinates, although I'd love to be corrected on this) 2. You are referring to the ability to perform path finding, the most common is A* Pathfinding (and is possible in Lua). The problem however is that you need to move the robot, detect which direction to go next, detect if it can go in that direction then move and repeat until you find a situation you are in where you can only move ba
  6. Harkole

    a

    It's all about scope, or better memory management. If you are only doing a small program it doesn't matter but good practice is important. Lua code runs in blocks, local variables are only available in the current block, a global variable is always available. What this means in terms of memory is a global variable, once created will sit around in memory until the program ends or you set the variable to nil. The Lua manual explains this with examples but I am posting from my phone so don't have access to the link at the moment. Here is the link to what I am explaining: http://www.lua.org/pil
  7. Harkole

    a

    Sleep is a wonderful thing! - The answer to your question is Concatantaion, in Lua it is very simple to do here is an example: local word = "a string of text" local num = 5 print(word..num) -- to have fixed text just do print("This is always the same text, with the number stored in num "..num) Because when I first saw this post I was half asleep and not paying attention below this line, in the spoiler, is a semi solution. To see my original post with a full example of what I'd try to do for you issue click the spoiler button - if you want the challenge of doing it your self (always more r
  8. I was waiting moderation approval for posting (being a new member) but at least you worked it out!
  9. OK done some testing (OC 1.5.6), nothing wrong with your program but two things I learned from this: Firstly, don't call your Lua script "redstone" it won't work and will give you instructions for using OC's redstone API (ended up calling mine testRed.lua) Secondly, frequency 0 doesn't work, but anything else appears to be fine. The "os.sleep(int)" command needs to be longer as the computer isn't guaranteed to be processed at fixed intervals which can lengthen or shorten the live period. I set it to 5 and, baring Frequency 0, never had an issue. You must have a Redstone Tier 2 ca
  10. Hi pBoachie, I've not tried this yet, but if you give me your basic setup (a screen shot of how you've got things connected) I will take a look as it's something I'll be doing eventually any way. So may as well take a stab at it now
  11. You need an IF statement around the sg,openIris() call, this statement needs to check the data you are sending in the sgMessageReceived validate it and if true open the iris. I'm not at home to test this code but based on the Wiki my limited experience with OC and LUA I can suggest the below to help you move forward. Without the broadcast code I've no idea what you've broadcast the "12345" text as, but if you read the wiki here: http://ocdoc.cil.li/component:modem you can see that it tells us your string will be one of the parameters sent at the end of the standard list. Simply check t
  12. Hi All, Hopefully this is in the right place and going to be helpful to someone! I've come from an older version of Computer Craft and Minecraft to 1.7.10 and OC and I've been brushing off the rust and trying to get things going. Having done the tutorials and messed around I thought I'd try doing a simple(!) tank reading program so I can check the fuel levels of my generator. Turns out that either my Google-foo is weak or that not many people have tried/done it. So below is how I did it with some explanations of techniques I used to work things out (so hopefully you can tell me a bette
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.