This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
EurypteriD's profile picture

Program Parameters

Started by EurypteriD, 09 February 2012 - 01:00 PM
EurypteriD #1
Posted 09 February 2012 - 02:00 PM
Hey guys.
First of all. Great thanks to Dan200 for this mod.
Lovely work you have done casper. It caused another person to install the mod. (with HUGE ideas)

But theres one commandline i cant find.
Ive seen several people create a lights program.

But my question is:
How do you define the "Lights on"
Is the "On" a parameter of a program called LIgths.
Or is it just 2 programs with different names "Lights on" and "Lights off"
————————————————————————————————-
Just for the fun to give you a picture of our idea
We want to create a "Shop system" With a mainframe that keeps track of the users purchases.
Gui would be something like.

q "What would you like to buy" - Start up on each terminal thats set for a "Shop"
a "Diamonds" - able to choose ANYTHING in the game
q "How many (50 credits each)" - Thinking of instead of a server to manage the cred create a encrpted Diskette
a "10"
q "That will be 500 are you sure of this purchase"
a "yes"
q "Charging creditcard" - Changing the code on the diskette or server
q "Sending package"
q "Delivery done"
q "Thank you for using our service"

Its for a server we are starting up running these mods.
Computercraft 1.5
Redpower 2
CCTV block
Wireless Redstone (will go when next update)
And maybe Buildcraft 3.1 (working on compatility issues "block ids")

how to earn the credits. Buying services from people. Taxes (to reduce how much money running on the server Like people below 5000 creds got 0% tax where one on 10 mil will have 4% or something)

I know the work behinds this but i need things like this to keep my mind working ;)/>/>
Any Ideas and Programmers for our cause would be apriciated
Casper7526 #2
Posted 09 February 2012 - 02:40 PM
I'm pretty sure what your seeing is basically just event loops.


lights = "off"
while true do
term.clear()
term.setCursorPos(1,1)
print ("Lights are: "..lights)
print ("Press [space] to toggle")
event, param1, param2 = os.pullEvent()
if event == "char" and param1 == " " then
if lights == "off" then lights = "on" else lights = "off" end
end

Typed off the top of my head just to see if thats what you were talking about.
EurypteriD #3
Posted 09 February 2012 - 03:31 PM
That looks nice but when i look at it.

It basicly just runs on Space. Every time you press space it switches.
Its nice and simple indeed.

I just tested it. But it dosent do anything it gives an error in line 2
"[string "lights"]:10" 'end' expected (to close 'while' at line 2)

Edit.

Found the error. there was lacking one end. But else very nice from top of your head ;)/>/>
Casper7526 #4
Posted 09 February 2012 - 04:33 PM
Yep, missed an "end" for the while loop haha

But thats the gist basically…

here's a quick event checker


while true do
event, param1, param2 = os.pullEvent()
print ("Event - "..event)
print ("Param1 - "..param1)
print ("Param2 - "..param2)
end
Now mash your face across the keyboard and you'll see whats happening ;)/>/>
EurypteriD #5
Posted 09 February 2012 - 04:54 PM
I did something like it with my rednet.
When ever i typed something on the reciever it started writing "redstone Char s" if i pressed s.

how i did it DONT ASK ;)/>/>

How do you change the terminal id. Like i renamed the folder in my windows but then all programs disapeared.
I belive i saw a io.renameterminal("name")
Or am i completely drunk and stoned?
Casper7526 #6
Posted 09 February 2012 - 04:57 PM
You can't change the terminal ID. It's set for life!

In 1.3 you will be able to break your computers and put them back down though (they will use the same ID as before)
EurypteriD #7
Posted 09 February 2012 - 08:36 PM
Maybe that would be a nice feature for the future.
To add "Fs.renameTerminal("name")

instead of having it to be name 0-xxxxx
Casper7526 #8
Posted 09 February 2012 - 08:40 PM
In 1.3 you can label your computers, their ID will stay the same but they will have a name.
arongy #9
Posted 10 February 2012 - 01:11 AM
I can't wait for 1.3 :3
EurypteriD #10
Posted 10 February 2012 - 08:15 AM
Indeed it will be sweet.
First part of the OS is running now (for the shopping system)

Added mods i need to include.
IC2
Rocket science
Redpower 2
Computercraft (newest ofc<3)
CCTV block

Issue.. Rocket science aint updated for 1.1 but i doubt server will be running before 1.2