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

When player spawns in spawnhouse, monitor left greets and shows player ID.

Started by Beatsleigher, 13 December 2012 - 10:00 AM
Beatsleigher #1
Posted 13 December 2012 - 11:00 AM
Hello again!

I'd like to create a spawnhouse on my server, and link it up to a computer with monitor.
I have got four computer and four monitors, which are all meant to have different texts, but in order for those texts to appear, a player needs to spawn in the spawnhouse (No matter if player is new, or died).

I'm completely new to Lua, and come from batch, HTML and VB 2010 (.net).
I have a faint idea, of how to accomplish this, but then again, I don't.

I'd imagine for the code to look somewhat similar to this (I'll write it in as much Lua, as I can, but the rest will probably be a mashup of batch and VB. Sorry!)

-- All this plays on monitor top (somehow)
Player = "Player"
-- Player declares variable for spawned players.
If Player.Spawned  = True Get PlayerID = True And Player = PlayerID
If Player.Spawned = True Then  print("Welcome,")
print(Player)
print("How are you, today?")
print("")
print("If you are new on this server, please read the rules and land prices, which are displayed on the other monitors. These rules/prices are for the safety of this server and prevent ground-hogging!")
print("Have a nice day,")
print(Player)
-- Now my imminent fail on trying to boot other computers..
computer#2.Boot
computer#3.Boot
computer#4.Boot

I do hope I'm not all that wrong. Thanks in advance for helpful and great answers!
May Notch be with you!

Edit: Some ways in making this program a bit nicer, in terms of functionality and adding functions, would be much appreciated, if that doesn't sound too greedy :)/>
Thanks again.
Edited on 13 December 2012 - 10:08 AM
Lyqyd #2
Posted 13 December 2012 - 11:08 AM
You'll want to look into using OpenCCSensors (or ccSensors, if you're using an ancient version of CC) to get player information. I have no idea what the getting player information code you have there came from; it looks like you just made it up on the spot. Also look into the peripheral API to see how to use the peripheral methods that computers expose, for turning the others on. Alternatively, keep their screens blank and wait for a rednet signal from the first computer, then act appropriately.
Beatsleigher #3
Posted 13 December 2012 - 11:10 AM
Like I said, I'm completely new to CC (Running 1.33). I'm running Tekkit 3.1.2, and I've never before had anything to do with Lua and/or CC :)/>

Thanks a lot, though! :)/>