ID:139325
 
Code:
computer_directory
parent_type = /datum
var
name = ""
list
contents = list()

computer_file
var
name = "" // file name including extension
contents = "" // text contents of file (if any)

program
// unable to open the same way but will run
proc/RunCode()
var
n_scriptOptions/nS_Options/options = new()
n_Scanner/nS_Scanner/scanner = new (contents, options)
list/tokens = scanner.Scan()
n_Parser/nS_Parser/parser = new (tokens, options)
node/block/GlobalBlock/P = parser.Parse() // line 21
n_Interpreter/interpreter

if(scanner.errors.len || parser.errors.len)
return -1 // errors
interpreter = new (program=P) // line 26
interpreter.Run()
return 1

computer_directory/root
name = "root"


Problem description:

I am trying to make a game with a command line interface similar to Console and plan on using Nickr5's Scripting library for the programming side of things however I run into the following error that doesn't make sense to me when attempting to compile this file:

computer\system.dm:26:error: P: undefined type: P computer\system.dm:21:warning: P: variable defined but not used

Both lines are marked in the above code snippet.

Please help if you can.
Looks like this is my fault, I probably forgot to update an example in the documentation. Line 21 should look like this:
node/BlockDefinition/GlobalBlock/P = parser.Parse()


I think the way the library is designed right now isn't great because the code you need to run even a simple script is ugly and overcomplicated. I'd like to update it sometime soon and would love any advice you have on how to maker it less of a pain. In the future, since it looks like people might actually be using the library now, I'll try to keep everything up to date and avoid breaking backwards-compatibility when possible.
In response to Nickr5
That did it cheers!
Yeah it is pretty difficult to get working, currently run into another problem of getting a proc to be called properly with the code:
<code> var/computer/C = root.owner interpreter.SetProc("print", /computer/proc/Output, C, list("text")) </code>

And that proc consisting of code for displaying things in a browser window emulating that looks like this: Output(text=null)

Very nice looking library though :D
In response to Lyndonarmitage1
path - The typepath of a proc to be called when the function call is read by the interpreter, or, if object is specified, a string representing the procedure's name.

Replace /computer/proc/Output with "Output". It would be nice if this were more consistent, but SetProc() basically just works the same way as call().
In response to Nickr5
Gah should of really paid attention when I was reading the reference heh.

Never really used or liked the call() proc

Will tell you my opinions on the library after I have used it some more.