Jump to content

Welcome to FTB Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

The LUA language


  • This topic is locked This topic is locked
11 replies to this topic

#1
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

As I didn't find a better place for this topic, here was my best bet to place it.

 

It is however not a question in the regular form, it is more a place we can educate each other using the LUA. I was searching high and low for a very very simple fix to my code, and as I go along, I'm bound to learn more.

 

All in all, this topic would be for the LUA shell used in ComputerCraft and by Turtles.

 

I think using pastebin for showing code here is better than the code brackets, as they don't interpret it.

 

So without further ado, let me show you what I found out trying to get the Gate Reader to work.

 

http://pastebin.com/yvzixMcD

 

Footnote: I know there is tons of places you can paste your code and get help, but I at least wants to help out in this community with LUA problems, although I'm not good at it, I get by searching and optimizing and testing till I get something that works and can paste back =)


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#2
ZER0-0

ZER0-0

    Advanced Member

  • Contributor
  • PipPipPip
  • 295 posts
  • Location:Planet Earth
  • Modpack:FTB Ultimate

So, is this a place to post turtle scripts and related things?


When in Trouble or in Doubt, Run in circles, Scream and Shout!


#3
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

Yes, they use LUA as well, post about working codes, codes you get errors on that you can't figure out, and the community will help out, that's what a good community should do.

 

A bit of a warning though, don't credit work you've found online as your own, if you wrote from scratch (looking at code examples or using snippets from other code is ok, as long as it is considered "normal" code, e.g; if you use a function written by someone else that is somewhat extensive, you should credit the author. If it is a small 'for loop' with a few function calls, this could just as well be deducted from the LUA documentation and should not need to be credited) you can claim it as your work, else you should clearly refer to the author of the code.

 

LUA is also licensed under the MIT license, but can be GPL licensed, essentially saying that you cant monetize your code.


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#4
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

Is this code for a computer?

Also, how do you copy code directly from a turtle/computer? I can't seem to.

 

Also, what is your gatereader supposed to do?


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234


#5
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

To start off, yes this is actual code that you can run a CC computer, the script is set to talk with the gate reader that you put next to it, and that gate reader can give you all the options the regular pipe gates can.

To copy a code into a turtle, you have to use a printer, or wireless, sadly copy pasting doesn't work to great, not for me at least.

 

The gate reader is supposed to read data gates normally would do, like gates on a tank valve, it detects fluid level.

Now if i were to put a gate reader there and a computer next to it, I could tell it to do something when e.g Full Power, No Power, Space in inventory, Is working, etc, is triggering something further in my code, like turn off green wire and blink x times on red wire. Which again maybe is connected to the lights, turning of the green wire made a blackout, but the pulsing on the red wire started your backup generator.

 

This scenario could be used if you put a gate reader next to an MFSU, and the computer hooked to that could get those data rapidly, and if lets say the MFSU must NEVER run out, that means meltdown in your reactor! uh oh! So what you do then, if you want to make an alarm system out of it using computers, you could write a program that read the Is Full flag, and when that turns false, you know the MFSU is draining, and in your system that means failure! So, luckily you have set up you gate reader next to your MFSU and hooked a computer to that. Now your running program detects a change in one of the values, and turns of the green wire, it also starts blinking on the red wire.

 

Now what can I with those wires now that I have my bulky, yet cool and flexible alarm system... Lets set red wire to some well placed red lights, dimmer than your regular lights, the green wire turns of the lights, and disables your biggest machines, as well as setting off a howler alarm!

 

Now you have a "dead" factory, its dark, and there is red light everywhere, the alarms chimes and there is absolute havok.

 

Luckily your nuclear technician is online, so inside all this chaos, he brave goes down into the reactor chamber and inerts the fuel.

He walks up like a hero, but everyone was hiding in the end, being eaten by the ender dragon!

 

So if you could follow that then you agree that Gate Readers ate your friends,

 

If you see past this article's creative aspect, you should find your answers,


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#6
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

To copy a code into a turtle, you have to use a printer, or wireless, sadly copy pasting doesn't work to great, not for me at least.

I mean copying from a computer/turtle to an actual document, pastebin in this context.

 

Okay, Gate Readers ate my friends?


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234


#7
ViperSRT3g

ViperSRT3g

    Advanced Member

  • Moderators
  • 212 posts
  • IGN:ViperSRT3g
  • Modpack:Unlisted Pack
It is easier to use the program CC Copy, it was developed by one of the members of the ComputerCraft forums. It's a useful tool that will type your scripts into the game for you. In this way, you can keep and edit your programs on your own computer, while being able to rapidly deploy them into the game. Or you can use what most people use and paste your scripts into pastebin then use the HTTP method to make the server download them for you.
Vanilla Server: vanilla.vipersrt3g.net
banner-13472.png
Snapshot Server: snap.vipersrt3g.net
banner-25377.png

#8
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

I mean copying from a computer/turtle to an actual document, pastebin in this context.

 

Okay, Gate Readers ate my friends?

Oh, okay, computers and turtles have a program built in for this, just type "pastebin program", were "program" is the name of your program, so for example "pastebin test"


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#9
Archina

Archina

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts
  • Location:East Midlands, England
  • Modpack:MindCrack Pack

Oh, okay, computers and turtles have a program built in for this, just type "pastebin program", were "program" is the name of your program, so for example "pastebin test"

Isn't the full code supposed to be "pastebin get [Pastebin ID] [Program Name]"?

 

A code example would be "pastebin get UrgqLk8U makeroom" (Credit to PhilHibbs for the program.)



#10
Hippieshaman

Hippieshaman

    Advanced Member

  • Members
  • PipPipPip
  • 185 posts
  • Location:Hippiecraft HQ
  • Modpack:FTB Unleashed

Isn't the full code supposed to be "pastebin get [Pastebin ID] [Program Name]"?

 

A code example would be "pastebin get UrgqLk8U makeroom" (Credit to PhilHibbs for the program.)

My bad, I just woke up, hehe.. You're right

 

"pastebin put [program name]" will paste a program to pastebin and output the pastebin URL to you.

"pastebin get [pastebin ID] [program name]" will fetch the contents of the given pastebin URL and put it in [program name].

 

20130216003135.png


Hippiecraft Community, since 2012.

Forum, Twitch, Youtube, Twitter, Planet Minecraft, Steam, Website

Contact us by e-mail: mail@hippiecraft.net | Support: support@hippiecraft.net


#11
Weels1566

Weels1566

    Admin

  • Administrators
  • 28 posts
  • Location:Australia
  • IGN:weels1566
  • Modpack:FTB 1.5.2 Beta Packs

Looking Good


header.png


#12
ZL123

ZL123

    Me.

  • Administrators
  • 2079 posts
  • Location:Not somewhere where people say a fake location to try to be funny
  • IGN:ZL123
  • Modpack:Private Pack

Oh. Didn't see that program! Thanks.


-ZL123
Hope I helped!

YT: http://youtube.com/ZL234
Twitter: https://twitter.com/ZL234





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users