View Single Post
  #46  
Old 11-10-2004, 02:21 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Stefan
NPC Code:

function compileScript() {
script = "";
script.add("function onCreated() {");

for (con: this.containers)
addControlCreationScript(script.link(),con,0);

script.add("}");
script.savelines("weapon.txt",0);

ScriptEditor.openScriptWindow(script);
}

Ruby (hackish):
NPC Code:

def compile_script
script = "function onCreated() {\n"\
" #{@containers.map{|con| control_creation_script(con, 0)}.join("\n ")}\n"\
"}"
File.open('weapon.txt', 'w') {|f| f.puts script }
ScriptEditor.open_script_window(script)
end

Reply With Quote