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

XFactHD

Members
  • Content Count

    10
  • Joined

  • Last visited

About XFactHD

  • Rank
    Junior Member

Contact Methods

  • Minecraft
    XFactHD
  • GitHub
    XFactHD

Recent Profile Visitors

1186 profile views
  1. How can I then solve the problem that my event handler is only triggering when I crash the program without shutting down the computer?
  2. Would it be enough to just remove the local on the callback function or do I need to do something else there? I also don't know what upvalues are.
  3. The little program with the empty while loop was just a test program. The while loop just keeps the program running until OC kills it. In my Base Control Program I need the while loop for the main code. If I use event.listen() then I can't call the listener in the main loop. Every forum post on touch events tells me to do exactly what I did in this program.
  4. In my Base Control Program I define a callback function: local function getClick(_, _, x, y, _, _) if x > 44 and x < 50 and y == 4 and active == false then setStatus(true) elseif x > 44 and x < 50 and y == 4 and active == true then setStatus(false) elseif x > 44 and x < 50 and y == 6 and safety == false then safety = true elseif x > 44 and x < 50 and y == 6 and safety == true then safety = false elseif x > 44 and x < 50 and y == 20 and spawnEnder == false then setSpawnEnder(true) elseif x > 44 and x < 50 and y == 20 and spaw
  5. I didn't change the pastebin link when writing the EDIT. Now I have another problem, if event.listen("touch", getClick) receives a touch signal, the defined callback function doesn't get triggered. If I try this in a small test program that prints the results to screen, the coordinates are exactly as expected.
  6. Now the code looks like that: http://pastebin.com/HpkWL09X and I get "control.lua:50: 'end' expected (to close 'function' at line 46) near 'elseif'". EDIT: I saw your edit and now everything works. Thank you very much for your help.
  7. OK, now the code looks like that: http://pastebin.com/nFuMSipk. But I still get an error: "control.lua:76: 'end' expected (to close 'function' at line 46) near <eof>".
  8. When trying to execute this code (http://pastebin.com/Kujgx5sx), the computer gives me the following error: "control.lua:73: 'end' expected (to close 'if' at line 47) near <eof>" If I comment out the erroring "if" block with the method to execute and the "end" statement or put an "end" statement at the expected position, it gives me the same error for another of the three "if" blocks. If I comment out all three if blocks, it expects me to put an "end" at <eof> to close the method. I don't get why, because all the "end" statements the computer expects are in the code. If I put al
  9. I don't know how to make code blocks on the mobile. As for your suggestion: The check for not nil is just because the program crashes if you add a timeout to event.pull and the if statement then that checks for the coordinates tries to use nil as a number. I have briefly looked into event listeners and I am not really sure how to use them.
  10. I have two questions on touch screen events: 1: Is it possible to make two parallel loops to not slow down the updating of the screen by pulling an event? 2: I have a program with some rather small buttons. At first I tried to use fixed coordinates in an if statement and then I used a range for the coordinates in the if statement but it still doesn't work for me. Here is the relevant code: http://pastebin.com/KJmUsgD7
×
×
  • Create New...

Important Information

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