hackmud

hackmud

Calling Scripts from a Script
I understand that I can't generate a string and call it as a script from inside my code.

But can I call predefined scripts?

When I pass a script as an argument with #s. I then want to check if it's safe before running .call() on it. How do I do it, this doesn't work:

function (context, args) { // target:#s.xxxx.yyy let res = #s.scripts.get_level{name: args.target.name} ; // <--- This is the problem return res; }
< >
Showing 1-4 of 4 comments
This'll be what you want:
let res = #fs.scripts.get_level({name: args.target.name}) ; // <--- This

Treat #fs.scripts.get_level() as if it was a script function.

The #fs is required for running scripts at FULLSEC level. For the other Seclevels it goes as so:

#fs OR #4s - FULLSEC
#hs OR #3s - HIGHSEC
#ms OR #2s - MIDSEC
#ls OR #1s - LOWSEC
#ns OR #0s - NULLSEC

If you are unsure what seclevel a script is, scripts.get_level is your friend :)
Correction: You can run a FULLSEC script with any of the #fs/#hs/#ms/#ls/#ns, and highsec can be run with any of those besides what's higher (FULLSEC) etc.

If you don't care about your script being seen as NULLSEC on scripts.get_level, you can use #ns/0s for all subscript calls.
#fs. instead of #s.

Gotcha.

Where is that documented? I'd like to read up on those scriptors. The official docs are really bare-bones?
Originally posted by JOHNNY GUEGGU:
#fs. instead of #s.

Gotcha.

Where is that documented? I'd like to read up on those scriptors. The official docs are really bare-bones?
It is documented in the scripting reference, it's in one of the forum pages I gave you earlier.

https://hackmud.com/forums/general_discussion/scripting_reference

Originally posted by hackmud scripting reference:
SUBSCRIPTS
If you want to call a hard-coded script (ed note: this isn’t a scriptor, it is just a script call, or a subscript), you can do so without using a scriptor, as follows. Be aware, you cannot store a script to a variable like this:

var x = #fs.user.name()

as #fs is really a preprocessing directive. #fs.user.name must be used immediately, in the form
#fs.user.name({key:value})
If you want to hard-code a script call that you can reuse, define a wrapper function, like:

function foo(args) {
return #fs.user.name(args);
}


As of 20/10/2017, the previous syntax #s.user.name will result in a nullsec script for subscripts (ED NOTE: now it's a syntax error). The syntax for scriptors is still #s.user.name and works properly. The new syntax is as follows:
#fs.a_user.a_command or #4s.a_user.a_command
Sec levels go from 0 (nullsec) to 4 (fullsec), or ns, ls, ms, hs, and fs. These guarantee that the calling script is *at least* of that sec level, otherwise returns {ok:false, msg:""}
< >
Showing 1-4 of 4 comments
Per page: 1530 50