Welcome to the new Diaspora forums, please let us know if you see anything broken! Notice: Some users may need to reupload their avatars due to an issue during forum setup!

Posts: 175Registered
edited March 2012 #1
So you've got a dozen E2s, and your dupes always have the out-of-date versions... What if I said you could (potentially) have them autoupdate... themselves.... whenever you want?

I requested from one of the Wiremod developers a function to do exactly that. I propose that we upload this custom E2 function to the servers (I've already tested it, so we totally don't need to use the Dev server for testing :P), for those E2 Moguls to rejoice in auto-updating E2s. I probably don't have to mention the awesome possibility of self-rewriting-e2s, do I?

The file is attached below, so anyone (with unzip capabilities :P) can view the source for the functions.

Showing is better than telling, no?
You use it like pos() etc, by going Entity:remoteUpload(), then you pass a filepath of the E2 you want to upload.
Everything ALWAYS happens from the Expression2 folder, and there's no way to get out of that - ever.
// Uploading the E2 found in Test.txt to the chip that calls it
inputs E:entity


EDIT: Divran, by request of someone else, added another function. This one is Entity:remoteUpload(string Code), example below.
// Uploading to the same E2
inputs E:entity


Now, the function have some safety checks. It will fail if:
• You are not the owner of the E2 being targetted.
• You ran the function less than 1 second ago.
• The file does not exist (Remember to add ".txt" to the end)
• You are already uploading an E2 to somewhere (either using the tool, the remote updater, or this extension).
• The target expression entity does not exist clientside (shouldn't happen, but could due to the way Source works)

It totally would have given error messages if it didn't work, but by adding that it started screwing up, so it will SILENTLY (NO ERRORS POPPING UP ANYWHERE, EVER) fail if you do something wrong.
Post edited by Unknown User on

"We fear that which we cannot see... we respect that which we cannot see... thus the blade will be wielded."

Not gonna lie, that sounds incredibly neat/useful. Have you tested it locally to see if they work without errors, and whatnot? If so, I'll totally throw it on the server.
• Posts: 175Registered
I totally think I installed it myself wrong, I'm gonna' keep playing with it (Probably going to have to find a tutorial on how to install custom E2 functions ) and I'll get back to you once I've got it working.

"We fear that which we cannot see... we respect that which we cannot see... thus the blade will be wielded."

• Posts: 175Registered
Okay, so it turns out I don't need the second function that's listed in remoteupload.lua, so that can be removed. It seems as though it screws up if I've got the returns in there, so we might have to remove those and have it silently fail. I'll attach a version you should use, below.

OP has been edited to have the latest version of the .zip, as well as giving examples on usage etc. There has also been some rewording of the post, etc, because I wrote it in a hurry. It's just overall better, I think.

"We fear that which we cannot see... we respect that which we cannot see... thus the blade will be wielded."

• Posts: 175Registered
Divran updated the code, there's now a new function. Details in OP.

"We fear that which we cannot see... we respect that which we cannot see... thus the blade will be wielded."