Jump to content


libraryaddict's Content

There have been 187 items by libraryaddict (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#18645 TCMail - Successor to ComputerCraft eMail

Posted by libraryaddict on 10 July 2012 - 06:49 PM in Programs

View PostTCGM, on 10 July 2012 - 03:00 PM, said:

View PostJackster, on 09 July 2012 - 07:31 PM, said:

Having a play.

Only reason for disk is if you remove the computer I guess?

The disk install instructions are for server admins who might want to mass-install this program on their server for a server-wide email system that works.

I'm also amazed that people are poking holes in my instructions. Seriously. I see quite a few programs in this subforum devoid of any instructions whatsoever. I can't know every possible install path! T_T

You assume we are morons.
You also assume we know exactly how to install a program we did not create



#18535 TCMail - Successor to ComputerCraft eMail

Posted by libraryaddict on 09 July 2012 - 07:17 PM in Programs

Hmm.
My first suggestion is to make the installation easier then a giant wall of text.

For instance.
"Just run: pastebin get p98yh0p89uh Installer"
"Then run "Installer" and follow instructions"
"You are done!"



#18380 Render is not sent to first computer till it moves

Posted by libraryaddict on 08 July 2012 - 02:33 PM in Ask a Pro

View PostPinkishu, on 08 July 2012 - 12:54 PM, said:

The problem is your server :)/>

function reDraw() -- Used for redrawing all clients into map and sending it out
  for n=1,#Clients do
	moveClient(n, Clients[n]["X"], Clients[n]["Y"], Clients[n]["Char"])
	moveScreen(Clients[n]["ID"], Clients[n]["X"]-(Clients[n]["Wide"]/2), Clients[n]["Y"]-(Clients[n]["High"]/2))
	draw(Clients[n]["ID"])
	local Cool = {returnView(Clients[n]["ID"])}
	rednet.send(Clients[n]["ID"], "draw"..textutils.serialize(Cool))
  end
  draw("Main")
  local G = {returnView("Main")}
  for n=1,#G do
	term.setCursorPos(1,n)
	term.write(G[n])
  end
end

Your moved() function which is called when a client moves only removes the client Char from the old position, doesn't place a new Char at its new position
now reDraw takes care of that though... but not fully, someitmes it would auto-correct itself through pings from what i've seen
But basically
you loop through the clients, you move each client and then send the array to them
so if client 2 moved you removed client 2's character

Loop Start client1
move client 1
send map to client1
Loop start clinet2
move client2
send map to client2

Notice the map you sent to client1 didn't move client2 yet, thus client2 is currently invisible

function reDraw() -- Used for redrawing all clients into map and sending it out
  for n=1,#Clients do
	moveClient(n, Clients[n]["X"], Clients[n]["Y"], Clients[n]["Char"])
  end
  for n=1,#Clients do
	moveScreen(Clients[n]["ID"], Clients[n]["X"]-(Clients[n]["Wide"]/2), Clients[n]["Y"]-(Clients[n]["High"]/2))
	draw(Clients[n]["ID"])
	local Cool = {returnView(Clients[n]["ID"])}
	rednet.send(Clients[n]["ID"], "draw"..textutils.serialize(Cool))
  end
  draw("Main")
  local G = {returnView("Main")}
  for n=1,#G do
	term.setCursorPos(1,n)
	term.write(G[n])
  end
end

might fix that: loop throuhg all clients and move them, then send each client the new map

or you might just set the new char at the end of the moved() function already

btw, from moveClients function
if Clients[n]["X"] == Clients[Client]["X"] and Clients[n]["X"] == Clients[Client]["X"] then
seems weird? did you mean "Y" at the latter part?

:|

Yet again you solve a brick wall of mine!



#18312 Render is not sent to first computer till it moves

Posted by libraryaddict on 08 July 2012 - 01:51 AM in Ask a Pro

http://www.computerc...puzzle-maze-01/

Look in the mutliplayer bit.
There are 2 files.
Make the server then join 2 clients.
Move the 2nd client around.
On the first client you will not see it moving..

But if you move it then its fixed.

This shouldn't happen at all :s
I don't see a reason for it to happen.
Its not because I forget to render it.

Everytime something changes everything is re-rendered and resent.
For the 2nd computer to move, The first must be sent it as well.



#18275 [1.33]Destroying a computer without a label set won't give back that computer.

Posted by libraryaddict on 07 July 2012 - 09:19 PM in Bugs

You can't tell one computer to quit everything..
Without quitting them both



#18270 Queued event system?

Posted by libraryaddict on 07 July 2012 - 09:00 PM in Suggestions

Sadly this means my while true do loops will begin to make the server lag..



#18263 Bored? Time the music for us plox..

Posted by libraryaddict on 07 July 2012 - 08:05 PM in Programs

:|
Thanks

To be fair this is one of my stupider posts..
And programs



#18262 Map API - Map of characters

Posted by libraryaddict on 07 July 2012 - 08:01 PM in APIs and Utilities

Updated my kinda vague post with a updated API!
Better then ever!
Almost godlike!

Featured in Maze Game!



#18254 [Game][Puzzle] Maze 0.2 - Multiplayer support!

Posted by libraryaddict on 07 July 2012 - 06:19 PM in Programs

Right.
We love mazes right?

Ofc we do.
Who are we kidding.

Featuring my latest program in a long time!
A program that took me 2 weeks of smashing down a brick wall with my head!
A program which Neppy had to help me out with to stop a lua giving a bug!

The maze runner!
Featuring no scoring system and no way to win but reach the other exit!
And no win message either!
Woo!

Oh and featuring my map API.
Which apparently was bugged in little ways and now acts like a god..

I've used someone elses maze generation algorithm as I did not want to touch it D:
And parts of it had to be rewritten and Neppy had to help me out with a function I could not rewrite successfully.

A great video by Jackster!


http://pastebin.com/ZB0xY0C5

Spoiler

If you want to play mutliplayer maze!
Client: http://pastebin.com/egPeayyC
Server: http://pastebin.com/xxkBBbpE

Theres a variable in server that is called "IP"
Change that to your IP if you like.

Easy to run multiplayer!

Its super easy to play this!
For bigger/smaller maps.
Just type "ProgramName XWide YHigh"
If you want to have the map generated the same time everytime you put in the number.
Then you add on a number after that!
So "Maze XWide YHigh 234623"

If you ask nicely I will add in a few features :P/>

Such as a scoring system, A user friendly menu.
Waypoints so you don't lose your way
Multiplayer functions

Anything is possible when you use libraryaddicts Map API.



#18253 Ingame IRC. Servers and Clients. v0.2

Posted by libraryaddict on 07 July 2012 - 06:12 PM in Programs

:|

Im very glad to see someone enjoys it.
Just add this to the first line
term.redirect(peripheral.wrap(side))



#18201 corountines

Posted by libraryaddict on 07 July 2012 - 11:12 AM in Ask a Pro

Found my fix :|
I just added a queue event and pull event instead of corountines.



#18078 corountines

Posted by libraryaddict on 06 July 2012 - 07:13 PM in Ask a Pro

Right, I've a program which REALLY hates yielding and arrays..
So Neppy came up with a fix which loves corountine to prevent yielding..

But my problem is this.
The more I call on it, The longer it and slower it runs..
So if I didn't call on it, Then it gets like %1 done in 1 sec.
If I do call on it a few times. Then its %7 in a minute.
But if I called on it much as I can then its %100 in a day.

Get what I mean?

Why is that happening?
And clearly there should be a cleaner fix through I don't like my inner brick wall..



#18077 Bored? Time the music for us plox..

Posted by libraryaddict on 06 July 2012 - 07:07 PM in Programs

View PostLyqyd, on 06 July 2012 - 05:28 PM, said:

This really belongs in General, not in the Program Library.

And aren't all of the songs someplace? It shouldn't be too difficult to just look up the lengths of each one.

About it being moved, Agreed.
And nope :|



#18029 Bored? Time the music for us plox..

Posted by libraryaddict on 06 July 2012 - 01:42 PM in Programs

Well dan200, genius as he is. He cannot determine when the music stops.
As for me, I don't really want to listen to all this.
So this is where you come in!

Just run this program next to a disk drive with a music disk in it.
And time it with the spacebar!
Then make a note for each music disk.

Then when you are sure you have the exact times for each music disk, Just post back in here with it :P/>
I'm more then happy to make a API which would use this.
But you can do it easily as well.

Just have
getAudioTime(Title)
if Title == mellohi then return 40
elseif Title == 13 then return 20
end
You get the idea :)/>
Except the titles will have the be the same as the ones that computer fetches with disk.getAudioTitle(side)



--Time music
function Clear()
  term.clear()
  term.setCursorPos(1,1)
end

function Check()
  for _,side in ipairs(rs.getSides()) do
    if disk.hasAudio(side) then
	  return side
    end
  end
end

function Time(Side)
  local Timed = nil
  Clear()
  print("Press spacebar to start timing, I will play the disk "..disk.getAudioTitle(Side).." at "..Side)
  while true do
    event,param1,param2 = os.pullEvent()
    if event == "key" then
	  if param1 == 57 then
	    if Timed == nil then
		  print("Recording")
		  Timed = 0
		  Tenth = os.startTimer(0.1)
		  disk.playAudio(Side)
	    else
		  print("Stopped recording, disk "..disk.getAudioTitle(Side).." was "..Timed.." seconds long")
		  Tenth = os.startTimer(0)
	    end
	  end
    elseif event == "timer" and param1 == Tenth then
	  Timed = (Timed+.1)
	  Tenth = os.startTimer(0.1)
    end
  end
end
	    
local Status = "Go"
repeat
  if Check() then
    Side = Check()
    Clear()
    for n=1,5 do -- Dont judge me!
	  print()
    end
    print(string.rep("-", 49))
    print("Music disk \""..disk.getAudioTitle(Side).."\" found at side "..Side)
    print(string.rep("-", 49))
    print("Do you want to play and time this disk? Press \"T\"")
    print(string.rep("-", 49))
    print("You can always check again with \"C\"")
    print(string.rep("-", 49))
    print("\"Q\" to quit")
    print(string.rep("-", 49))
    while true do
	  event,param1 = os.pullEvent()
	  if event == "char" then
	    if param1 == "t" then
		  Time(Side)
	    elseif param1 == "q" then
		  Status = "Stop"
		  break
	    elseif param1 == "c" then
		  break
	    end
	  end
    end
  else
    Clear()
    print("No music disk found")
    os.pullEvent()
  end
until Status == "Stop"



#17888 Turning a function that depends on repetition to tables

Posted by libraryaddict on 05 July 2012 - 01:50 PM in Ask a Pro

I have this code from :
This function gives problems as it features repetitions.
This is normally not a problem.. Unless you want a big maze.

function Maze:_process_neighbor_cells(x, y)
    self.cells[y][x].is_visited = true

    local neighbor_cells = self:_shuffle(self:_get_neighbor_cells(x, y))

    for index, neighbor_cell in ipairs(neighbor_cells) do
        if self.cells[neighbor_cell.y][neighbor_cell.x].is_visited == false then
            if neighbor_cell.x > x     then     -- open wall with right neighbor
                self.cells[y][x].right_wall                              = false
                self.cells[neighbor_cell.y][neighbor_cell.x].left_wall   = false
            elseif neighbor_cell.x < x then     -- open wall with left neighbor
                self.cells[y][x].left_wall                               = false
                self.cells[neighbor_cell.y][neighbor_cell.x].right_wall  = false
            elseif neighbor_cell.y > y then     -- open wall with bottom neighbor
                self.cells[y][x].bottom_wall                             = false
                self.cells[neighbor_cell.y][neighbor_cell.x].top_wall    = false
            elseif neighbor_cell.y < y then     -- open wall with top neighbor
                self.cells[y][x].top_wall                                = false
                self.cells[neighbor_cell.y][neighbor_cell.x].bottom_wall = false
            end

            -- recursively process this cell
            self:_process_neighbor_cells(neighbor_cell.x, neighbor_cell.y)
        end
    end

    return
end

If anyone is able to turn this to NOT use repetition.
I would be very very grateful.

I've tried to do this a few times but rage quitted..
If you would like to know how this works
Its kind of simple.

Function is called on
Function checks all sides around the sides it was given
If sides matches sides then it does some stuff then calls on this function again
If not then it returns
Function ends

Basically its function inception..



#17396 Menu, Scrollable!

Posted by libraryaddict on 01 July 2012 - 12:13 PM in APIs and Utilities

View Posteperdeme, on 01 July 2012 - 10:55 AM, said:

The functions you have to call the 'Menu' are calling lowercase 'menu' instead of the valid function 'Menu' took me 15mins (sadly) to figure out where I was going wrong :)/>

If only there was a Perl based computercraft :P/>

Didn't notice, Fixed



#16638 Monitor Multi-Line Messages

Posted by libraryaddict on 24 June 2012 - 12:51 PM in APIs and Utilities

You can't have characters in a monitor all different sizes.
The whole screen has only one font size that effects all.

Try this
function monitor(side)
    if peripheral.isPresent(side) then
	    term.redirect(peripheral.wrap(side))
    end
end

function size(side, number)
  if peripheral.isPresent(side) then
	  peripheral.wrap(side).setTextScale(number)
  end
end

This is clearly not a program
But use this with a print("bla") and thats the closest you are going to get without making it look pretty.
Just whip it into a program :P/>



#16637 Simple Prompt Software

Posted by libraryaddict on 24 June 2012 - 12:47 PM in APIs and Utilities

View PostCloudy, on 23 June 2012 - 12:02 PM, said:

And? Just because you have an API which does something does not mean their accomplishment is any less.

Nice work OP :-)

Aie.
I know I came across as a jerk.

What I meant to say in the other post but somehow didn't say.
You should look at turning prompts into a table.
Unlimited prompts :P/>



#16569 Simple Prompt Software

Posted by libraryaddict on 23 June 2012 - 11:48 AM in APIs and Utilities

Hmm, No offense but my menu API could easily do this.

You could work the API into your code :P/>



#16568 Slot Machine help

Posted by libraryaddict on 23 June 2012 - 11:47 AM in Ask a Pro

Thats less of a "help me" then a "give me fully functioning program"

You would have more luck doing it yourself.



#16567 Uses for CC for the Spleef World Cup.

Posted by libraryaddict on 23 June 2012 - 11:45 AM in General

Auctally pistons are faster >.>
But turtles can do any size arenas.



#16184 Slot Machine

Posted by libraryaddict on 19 June 2012 - 12:09 PM in Programs

Nice program, I've planned to make something like this.
Never occurred to me to use monitors + button.
Still going to have to find a way to control the payment >.>



#16170 My little scripter

Posted by libraryaddict on 19 June 2012 - 05:31 AM in Turtle Programs

View Postkazagistar, on 18 June 2012 - 03:04 PM, said:

Are you trying to create an automated version of the shell? Why not just make a program that calls shell.run on every line of your script file? That way, you can add more functions just by adding in new programs.

I could run it as a shell, however there is just one big problem.
It would just make the coding look worse :

As it is, It checks the file to see if its legit. Then it runs it.
What can your suggestion do that this doesn't do as good?



#15942 Map API - Map of characters

Posted by libraryaddict on 16 June 2012 - 02:47 PM in APIs and Utilities

Important
If you want to use this, Ask for a updated API.
I often update it and I'm kind of lazy.
Barely any bug fixes and lots of features added.

If you would like a guide on using my API, Just ask.
If you want a updated version, Either post in here or send me a mail.

Confusing title I know..
Basically this stores a "map" into a table. Which you can then modify.
Basically, Use this if you plan to make a game.
Or plan to make something that prints off stuff to the screen.

This is basic as I want to give the programmer control.
I was going to add in checking for the moveScreen() so it can't extend beyond the range.
But then that would A. Look messy. B. Might interfere with your programming..
Edit: I've changed this so you have it render anything off the map as " "
If you don't want this, Add in checks!

http://pastebin.com/9Dnyp2MX - The API!

Looking for a example?

http://pastebin.com/VfN0PFsi - A program you could test out on!

I am sorry if I do not make sense.
But this allows you to make a map you could easily edit.
Its a map on the screen. Made out of characters.
Using this you can easily do many things.
Such as moving a enemy character in a game.
Indicating where a turtle is.

If you still are confused, by all means try out the example program.
Name the API MapsAPI

Use "asdw" to navigate

I origanally made this for a game API which I realised was stupid.
So I redesigned it to be a map API.
Which was stupid.
So I remade it in 20min to a.. Godly API.

But to those who use the sample program.
You will notice you can move the viewed screen around with the asdw keys.
It creates a file called "World" which is the map.
It was 6000x6000 before but it was getting errors while making it >.>

It looks similar to the edit program.
But its way way different.
I will eventally get around to my custom edit program which will use this to display..
The main advantages my custom edit program will feature is multiple people can edit one file.
The file would be stored at one computer while 2+ can access that one file and edit it just like normal.

So I could work on the password script and you did your redstone stuff.

Cheat sheet!
createMap(MapName)
loadMap(MapName) -- Load a file into the API
cView(Viewer, Map, xWide, yHigh) -- Create a view point on this map which is x chars wide and y chars high
dView(Viewer) -- delete the viewer
draw(Viewer) -- Draws the viewpoint from the viewer.
editMap(Map, X, Y, Char) -- Edit the map at this point to replace the char there with this char
returnView(Viewer) -- Returns the view to whatever called it. Catch like this Stuff = {returnView("ME!!")} then its loaded into the table "stuff" in your program
moveScreen(Viewer, X, Y) Moves the viewpoint of the viewer to that x, y
saveMap(Map, Location) Saves the loaded map into the location
replaceLine(Map, LineNo, From, To, StuffToReplaceWith) replaceLine("World", 3, 10, 30, "") would replace line 3 at map World chars 10 to 30 with ""
insertLine(Map, y, data) Makes a new line there
removeLine(Map, y) do I really need to say this?
getSize(Map)
returnChar(Map, X, Y) returns the char there



#15878 Menu, Scrollable!

Posted by libraryaddict on 15 June 2012 - 10:01 AM in APIs and Utilities

View PostHexicube, on 08 June 2012 - 03:40 PM, said:

One quick suggestion, change:
local first = MenuStuff[1]
local second = MenuStuff[2]
table.remove(MenuStuff, 1)
table.remove(MenuStuff, 1)
To:
local first = table.remove(MenuStuff, 1)
local second = table.remove(MenuStuff, 1)

Lua returns the removed element. :(/>

Didn't know that
Edited.