How to script please?
I have my .js file I can edit and upload and run, but I can't seem to figure out what I can do with it. What syntax or commands are actually available to work with in that capacity?
Do I just need to keep grinding and unlock upgrades? Will that show me anything new? Or am I missing something?
I just really want to script the grinding process so badly right now :)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Haha! I get you. :D
Here are a few things you can do:
#s.<user>.<scriptname>({<parameters>}); will let you run a sub-script in your script. Here are a few examples of that:
- #s.accts.balance(); // will return the running user's account balance
- #s.scripts.fullsec(); // will return an array of full security script names
- #s.accts.transfer({to:"seanmakesgames", amount:"5KGC"}); // will transfer 5000GC to seanmakesgames from the running user
- #s.anon_2t3t4a.pub_info_32hhef({EZ_21:"unlock"}); // will attempt to unlock a script with the name anon_2t3t4a.pub_info_32hhef and an ez_21 lock
----
var results = #db.f({is_cool:true});
var resultArray = [];
while(results.hasNext())
{
var result = results.next();
resultArray.push({name: result.name, worth: l.to_gc_str(result.worth.valueOf())});
}
return resultArray;
// ---
// the above block of code will return all rows from your db that 'are cool' as an object with its name and its worth in GC string
----
more mongodb queries and stuff can be found here:
http://docs.mongodb.org/manual/reference/method/
count #db.c(), insert #db.i(), update #db.u(), remove #db.r(), find #db.f(), findAndModify #db.m(), save #db.s()
are all available in code.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Woot! thanks man! this is really helpful
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sweet. Glad it was helpful. :D
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
banging my head against the wall trying to come up with a way to pass a script in as an argument to my script... is this possible? that damn #s...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You definitely can pass a script into a function! Use a functor! Unfortunately, at this time you can't pass in a script name via string, but you can pass in a function object or even a LIST of function objects. ( <3 javascript ) Some untested code:
var listOfScripts = [
function(params) { return anon_th23n4.pub_info_rc323t(params); },
function(params) { return uknown_th23n4.access_23h5h5(params); }
];
// Then you can call the functions
listOfScripts[0]({foo:"bar"});
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
er make those calls #s.anon_th23n4 ...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
user @soron created this page for scripting tips:
http://ethankaminski.com/fanstuff/hackmud/coding-info.html
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You definitely can pass a script into a function! Use a functor! Unfortunately, at this time you can't pass in a script name via string, but you can pass in a function object or even a LIST of function objects. ( <3 javascript ) Some untested code:
var listOfScripts = [
function(params) { return anon_th23n4.pub_info_rc323t(params); },
function(params) { return uknown_th23n4.access_23h5h5(params); }
];
// Then you can call the functions
listOfScripts[0]({foo:"bar"});
seanmakesgames
{150518.0023}
Hello seanmakesgames,
Can you make an example on how to use this method for passing a script "name" to a custom script? I have tryed in many ways passing the functor (with the script name inside) as argument to my scripts but so far all attempt resulted in TypeError: XXXXXXXX is not a function.
Thanks a lot,
Oracle.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I have tryed in many ways passing the functor (with the script name inside) as argument to my scripts but so far all attempt resulted in TypeError: XXXXXXXX is not a function.
You can't pass a functor inside of the CLI. For this you need to use a scriptor: my.function { target:#s.my.target }. If you want to pass functors you have to do it in the script that defines them.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -