hackmud

hackmud

assistance?
trying to work on a script to potentially be added to a bot brain for passive income. and im getting a.t call is not a valid function.
was wondering if anyone could assist.

function(context, args) { try { // Retrieve script list from the specified sector let script_list = #fs.scripts.fullsec({ sector: "DATA_LAMBDA_6" }); // Check if script_list is an array if (!Array.isArray(script_list)) { return { error: "script_list is not an array" }; } // Filter the script list to include only those with '.public' in their name let filtered_list = script_list.filter(script => script.includes('.public')); // Initialize an array to store results let results = []; // Loop through the filtered script list for (let script of filtered_list) { try { // Construct the parameter with #s.${script} as the script name let target = `#s.${script}`; // Call #fs.k1mpp4.scraper with correct parameters let result = #fs.k1mpp4.scraper({ t: target }); // Check if result is an array if (Array.isArray(result)) { results.push(...result); // Spread elements of result array into results } else { results.push(result); // Push single result into results array } } catch (e) { // error handling results.push(`Error processing ${script}: ${e.message}`); } } // Return the results array return { results }; } catch (err) { // Handle general errors in the script return { error: `Error: ${err.message}` }; } }
< >
Showing 1-3 of 3 comments
Scriptors (a common name for "callable script objects") can only be created via the command line interface - scripts can't make scriptors out of string.

In other terms, you can't directly feed the output of a scraper to a cracker. The callable script needs to be parsed by the client. And thats a whole different level of automation.
Originally posted by Spanospy:
Scriptors (a common name for "callable script objects") can only be created via the command line interface - scripts can't make scriptors out of string.

In other terms, you can't directly feed the output of a scraper to a cracker. The callable script needs to be parsed by the client. And thats a whole different level of automation.

well, ♥♥♥♥. why isn't this in the scripting reference docs? :(
Originally posted by Zero:
well, ♥♥♥♥. why isn't this in the scripting reference docs? :(

https://hackmud.com/forums/general_discussion/scripting_reference
CONVERTING A STRING (like "foo.bar") INTO A CALLABLE
Many people want to take a string, like a loc from an NPC corp, and call it directly inside another script. This is, deliberately, impossible in hackmud. If you could convert a string into a callable in any way, the entire security level system would fall apart (because any string in any dependency could possibly be a nullsec script. And those strings could come from the database). If you want to do something with those locs (or similar cases), you will have to pass them in as a scriptor or hard-code them in the file. You cannot call the string directly.

As of the new seclevel update, the above security concerns are no longer an issue as you can specify the security level you’re expecting a script to be. You still cant convert a string into a callable, but we may get this in the future
< >
Showing 1-3 of 3 comments
Per page: 1530 50