16
Off Topic / does anyone here have a pebble time?
« on: May 02, 2016, 12:16:46 AM »
was considering getting one, curious to know if anyone here has one
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
function convertTempoToMS(%tempo) {
return 60000/%tempo;
}
function initPickaxes() {
%file = new FileObject();
if(!isFile("config/server/MinerTeams/loops.db")) {
%file.openForRead("config/server/MinerTeams/loops/loops.db");
} else {
warn("NO LOOP DATABASE FOUND.");
%file.delete();
return;
}
%tempScript = new FileObject();
while(!%file.isEOF()) {
%data = %file.readLine();
%tempo = getField(%data, 1);
%tempoMS = convertTempoToMS(%tempo);
%datablock = "PickaxeImage_" @ strReplace(%tempo, ".", "_");
if(!isObject(%datablock)) {
echo("Creating dynamic datablock for tempo of" SPC %tempo @ "BPM...");
%tempScript.openForWrite("config/server/MinerTeams/temp.cs");
// this is just too much to eval fml
// dynamic item images when
%tempScript.writeLine("datablock shapeBaseImageData(" @ %datablock @ " : hammerImage) {");
%tempScript.writeLine("stateTimeoutValue[1] = 0;");
%tempScript.writeLine("stateTimeoutValue[2] = 0.01;");
%tempScript.writeLine("stateTimeoutValue[3] = " @ ((%tempoMS/2)/1000)-0.01 @ ";");
%tempScript.writeLine("stateTimeoutValue[4] = 0;");
%tempScript.writeLine("stateTimeoutValue[5] = " @ ((%tempoMS/2)/1000)-0.01 @ ";");
%tempScript.writeLine("stateTimeoutValue[6] = 0;");
%tempScript.writeLine("rotation = eulerToMatrix(\"0 0 0\");");
%tempScript.writeLine("mountPoint = 0;");
%tempScript.writeLine("offset = \"0 0 0\";");
%tempScript.writeLine("emap = true;");
%tempScript.writeLine("eyeOffset = \"0 0 0\";");
%tempScript.writeLine("};");
%tempScript.writeLine("function " @ %datablock @ "::onHitObject(%this, %obj, %slot, %col, %d, %e, %f) {");
%tempScript.writeLine("hitObject(%this, %obj, %slot, %col, %d, %e, %f);");
%tempScript.writeLine("}");
%tempScript.close();
exec("config/server/MinerTeams/temp.cs");
}
}
%tempScript.delete();
%file.close();
%file.delete();
}