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!
Remote E2 Upload
NinjrKillr
Registered Posts: 175
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.
Detail about the function.
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.
EDIT: Divran, by request of someone else, added another function. This one is Entity:remoteUpload(string Code), example below.
Now, the function have some safety checks. It will fail if:
[list]
[*]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)[/*][/list]
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.
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.
Detail about the function.
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 entity():remoteUpload("Test.txt") // Uploading the E2 found in Test.txt to a DIFFERENT chip @inputs E:entity E:remoteUpload("Test.txt")
EDIT: Divran, by request of someone else, added another function. This one is Entity:remoteUpload(string Code), example below.
// Uploading to the same E2 entity():remoteUpload("print(\"This is a test\"") // Uploading to a DIFFERENT chip @inputs E:entity E:remoteUpload("print(\"This is a test\"")
Now, the function have some safety checks. It will fail if:
[list]
[*]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)[/*][/list]
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.
"We fear that which we cannot see... we respect that which we cannot see... thus the blade will be wielded."
Comments
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.