Jump to content


LoganDark's Content

There have been 172 items by LoganDark (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#242256 How to break a loop out of scope

Posted by LoganDark on 03 January 2016 - 04:50 AM in Ask a Pro

View PostLignum, on 02 January 2016 - 11:52 PM, said:

You could call error without any arguments as such, which will instantly stop the program:
error()


I'm wondering if that will stop the program without causing a newline, hmm might have to test it. Going to edit post after testing.

Edit: I have tested it and it works perfectly! Thanks!

View PostLignum, on 02 January 2016 - 11:52 PM, said:

{see above}

However, in my opinion, this is a very ugly solution. I suggest you do something like this instead:

local keepRunning = true

while keepRunning do
   --# ...
end

Now if you set keepRunning to false, the loop will stop. Keep in mind that if you do this while the loop is running, the loop will finish its current iteration before it stops.

I have tried that, and it seems to work most of the time, but I don't think this is the correct solution.



#242228 How to break a loop out of scope

Posted by LoganDark on 02 January 2016 - 11:39 PM in Ask a Pro

I've discovered there is no way to stop a "while" loop from a function defined out of scope, for example this will not work:
function stop()
  term.setTextColor(colors.white)
  term.clear()
  term.setCursorPos(1, 1)
  break
end

while true do
  print("Exiting program in 2 seconds")
  sleep(2)
  stop()
end
Because, from the scope of the function, there is no loop to break, unless it is defined inside of the loop, as such:
while true do
  local function stop()
    term.setTextColor(colors.white)
    term.clear()
    term.setCursorPos(1, 1)
    break
  end

  print("Exiting program in 2 seconds")
  sleep(2)
  stop()
end

Unfortunately, this function can only be used inside of the loop it is defined within, and loops nested inside that use the function will end the loop the function is defined in.

I would like to be provided with a function that can be defined once and end all loops, to ultimately stop the program, but while clearing the screen and stopping all loops.



#241977 Compress - Transform a folder structure into a single self-extracting file!

Posted by LoganDark on 31 December 2015 - 06:54 PM in APIs and Utilities

Encryption seems like a great idea! Allow people to specify a password for the file, and when you run it, have it ask you for the password, and if it is correct (store a sha256 hash of the password inside) then decrypt the stored program (using the password), hide it somewhere (maybe make it .temp) and run it!



#241425 [CC 1.76+] BLittle API

Posted by LoganDark on 25 December 2015 - 12:58 PM in APIs and Utilities

View PostBomb Bloke, on 24 December 2015 - 10:19 PM, said:

Creepers with Santa hats... Heh, hope none fall down my chimney!

*hears creeper burning in fireplace*

Soon that will be a problem...



#240473 LoganDark's Password Lock System

Posted by LoganDark on 14 December 2015 - 04:11 PM in APIs and Utilities

View PostAnavrins, on 14 December 2015 - 07:58 AM, said:

I'm not sure anymore...

I'm sorry.



#240450 LoganDark's Password Lock System

Posted by LoganDark on 14 December 2015 - 06:58 AM in APIs and Utilities

Dude, I'm sorry. I forgot to add the termination, but thought I added it.

I'm not trying to offend you, I'm not saying what you're doing is wrong, I'm just saying you offended me by accident.

I overreact easily...



#240447 LoganDark's Password Lock System

Posted by LoganDark on 14 December 2015 - 03:52 AM in APIs and Utilities

Sorry, post removed



#240431 LoganDark's Password Lock System

Posted by LoganDark on 13 December 2015 - 10:38 PM in APIs and Utilities

Post removed



#240430 Beep Tone

Posted by LoganDark on 13 December 2015 - 10:33 PM in Suggestions

You should be able to control the tone of the beep.

I think this would be a good idea, but it should have a cooldown to prevent beep spam.

Also, only advanced / command computers should have this feature.



#240203 Dog's Progs for Stargates, Biolocks, and more!

Posted by LoganDark on 11 December 2015 - 09:52 PM in Programs

View PostCreator, on 09 December 2015 - 04:02 PM, said:

Well, that's how it works. if you don't have many bugs, no one responds.

Must be why my password lock system is no longer getting replies. :P

Edit: Oh no, the arrival of a horde of replies to this thread is imminent...



#239959 [CC1.75] Crash on creating a new world

Posted by LoganDark on 09 December 2015 - 04:16 PM in Bugs

Updating Java didn't fix the problem, unfortunately.

Edit: Oops, the render distance likely was higher than 32. I lowered it to 3 and MC worked perfectly! Thanks!



#239940 [CC1.75] Crash on creating a new world

Posted by LoganDark on 09 December 2015 - 08:37 AM in Bugs

I have solved the problem! My render distance was set higher than 32.

Hi, when I try to visit/create a world, it says "Shutting down internal server..." and this error shows up:

---- Minecraft Crash Report ----
// Why did you do that?

Time: 12/9/15 12:33 AM
Description: Unexpected error

java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:512)
at java.nio.DirectIntBufferU.get(DirectIntBufferU.java:248)
at net.minecraft.client.renderer.RenderGlobal.func_72712_a(RenderGlobal.java:350)
at net.minecraft.client.renderer.RenderGlobal.func_72732_a(RenderGlobal.java:294)
at net.minecraft.client.Minecraft.func_71353_a(Minecraft.java:2216)
at net.minecraft.client.Minecraft.func_71403_a(Minecraft.java:2146)
at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:240)
at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70)
at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13)
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2061)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at java.nio.Buffer.checkIndex(Buffer.java:512)
at java.nio.DirectIntBufferU.get(DirectIntBufferU.java:248)
at net.minecraft.client.renderer.RenderGlobal.func_72712_a(RenderGlobal.java:350)
at net.minecraft.client.renderer.RenderGlobal.func_72732_a(RenderGlobal.java:294)
at net.minecraft.client.Minecraft.func_71353_a(Minecraft.java:2216)
at net.minecraft.client.Minecraft.func_71403_a(Minecraft.java:2146)
at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:240)
at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70)
at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13)
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212)

-- Affected level --
Details:
Level name: MpServer
All players: 0 total; []
Chunk stats: MultiplayerChunkCache: 0, 0
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (8,64,8), Chunk: (at 8,4,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 0 game time, 0 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 0 total; []
Retry entities: 0 total; []
Server brand: ~~ERROR~~ NullPointerException: null
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:373)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2444)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:927)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Mac OS X (x86_64) version 10.7.5
Java Version: 1.6.0_65, Apple Inc.
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Apple Inc.
Memory: 102485256 bytes (97 MB) / 280969216 bytes (267 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 5 total; -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1566 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1566-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1566} [Minecraft Forge] (forge-1.7.10-10.13.4.1566-1.7.10.jar)
UCHIJAAAA ComputerCraft{1.75} [ComputerCraft] (ComputerCraft1.75.jar)
GL info: ' Vendor: 'Intel Inc.' Version: '2.1 APPLE-7.4.1' Renderer: 'Intel GMA X3100 OpenGL Engine'
Launched Version: 1.7.10-Forge10.13.4.1566-1.7.10
LWJGL: 2.9.1
OpenGL: Intel GMA X3100 OpenGL Engine GL version 2.1 APPLE-7.4.1, Intel Inc.
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because EXT_framebuffer_object is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: [TARDIS-MCP-master]
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

I'm running ComputerCraft 1.75 on Mac OS X 10.7.5 with FML version 10.13.4.1566-1.7.10.

I'm also running this on a MacBook from early 2008, not sure if that has something to do with it but yeah.

Also, here's the data I get on launcher start:


[23:41:03 INFO]: Minecraft Launcher 1.6.44 (through bootstrap 5) started on osx...
[23:41:03 INFO]: Current time is Dec 8, 2015 11:41:03 PM
[23:41:03 INFO]: System.getProperty('os.name') == 'Mac OS X'
[23:41:03 INFO]: System.getProperty('os.version') == '10.7.5'
[23:41:03 INFO]: System.getProperty('os.arch') == 'x86_64'
[23:41:03 INFO]: System.getProperty('java.version') == '1.6.0_65'
[23:41:03 INFO]: System.getProperty('java.vendor') == 'Apple Inc.'
[23:41:03 INFO]: System.getProperty('sun.arch.data.model') == '64'

I hope you can make use of the data I've provided, I have no idea what is causing this or how to fix it. Any help?

Edit: System specs below :)

// Uh... Did I do that?

Time: 12/9/15 8:14 AM
Description: Loading screen debug info

This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Mac OS X (x86_64) version 10.7.5
Java Version: 1.6.0_65, Apple Inc.
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Apple Inc.
Memory: 25140848 bytes (23 MB) / 189718528 bytes (180 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 5 total; -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML:
GL info: ' Vendor: 'Intel Inc.' Version: '2.1 APPLE-7.4.1' Renderer: 'Intel GMA X3100 OpenGL Engine'



#239937 Dog's Progs for Stargates, Biolocks, and more!

Posted by LoganDark on 09 December 2015 - 06:35 AM in Programs

Lol, I am genuinely surprised this post doesn't already have like, 200 million replies.



#239935 LoganDark's Password Lock System

Posted by LoganDark on 09 December 2015 - 05:37 AM in APIs and Utilities

Next time, try to explain to me how to use the algorithm. I'm not good at figuring things out unless you point out that I need to.



#239934 LoganDark's Password Lock System

Posted by LoganDark on 09 December 2015 - 05:31 AM in APIs and Utilities

View PostDog, on 09 December 2015 - 05:23 AM, said:

I haven't tested it, but I did see one thing in your code that I'd recommend doing differently.

On line 189 you set os.pullEvent = os.pullEventRaw but you don't backup os.pullEvent or restore it when the script is done. This will disable CTRL-T for everything on that computer until a restart (which will run your login and disable CTRL-T again).

I'd recommend doing the following. On line 189 backup os.pullEvent before pointing it os.pullEventRaw...
local oldPullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw

Then at the end of your code, restore os.pullEvent so the computer operates as expected...
os.pullEvent = oldPullEvent

Oh, sorry. I seem to have forgotten the fact that the os.pullEvent is global. Silly me, fixed. Restarting the computer will apply the patch.

Also, not to be rude or anything, but you do not have to provide a method to restore it. I can figure things out on my own.

P.S. You did not offend me, what I have written may suggest you have.



#239885 LoganDark's Password Lock System

Posted by LoganDark on 08 December 2015 - 02:27 AM in APIs and Utilities

Post removed



#239840 ComputerCraft 1.74 and ComputerCraftEdu!

Posted by LoganDark on 07 December 2015 - 06:39 PM in General

View PostTheOddByte, on 02 July 2015 - 03:37 PM, said:

How come no one has posted here yet?

Lol, I was thinking the same thing. But, I got to claim my spot on the first page too. :P

Also, anyone who reads this likely won't have time to reply since they're too busy with ComputerCraft xD

CC is so awesome.

Dan200, you made one of the best mods out there! It also uses Lua, my favorite coding language! :D



#239839 LoganDark's Password Lock System

Posted by LoganDark on 07 December 2015 - 06:07 PM in APIs and Utilities

Post removed



#239805 OmniOS - The OS than can do (almost) anything

Posted by LoganDark on 07 December 2015 - 07:12 AM in Operating Systems

Nice! I really like this OS, but there are some catches I don't really like.



#239804 vBenchmark - The Ultimate Benchmarking Tool

Posted by LoganDark on 07 December 2015 - 07:05 AM in APIs and Utilities

Thanks! I never thought I would come across a useful benchmarking tool until I found this beauty. May I ask, who made the ASCII art?



#239800 LoganDark's Password Lock System

Posted by LoganDark on 07 December 2015 - 05:10 AM in APIs and Utilities

Post removed



#239790 LoganDark's Password Lock System

Posted by LoganDark on 07 December 2015 - 02:39 AM in APIs and Utilities

I have no code to show here. Existing computers running my password lock will continue to function but will not show they are running my system.

new post here