mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Merge pull request #1572 from ZappoMan/bugfixes
Fix issue #1519 and adds feature #1520
This commit is contained in:
commit
cffe9624a6
3 changed files with 31 additions and 1 deletions
26
examples/count.js
Normal file
26
examples/count.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// count.js
|
||||
// hifi
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 12/31/13.
|
||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
// This is an example script that runs in a loop and displays a counter to the log
|
||||
//
|
||||
|
||||
var count = 0;
|
||||
|
||||
function displayCount() {
|
||||
print("count =" + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
function scriptEnding() {
|
||||
print("SCRIPT ENDNG!!!\n");
|
||||
}
|
||||
|
||||
// register the call back so it fires before each data send
|
||||
Agent.willSendVisualDataCallback.connect(displayCount);
|
||||
|
||||
// register our scriptEnding callback
|
||||
Agent.scriptEnding.connect(scriptEnding);
|
|
@ -51,11 +51,12 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems,
|
|||
if (scriptMenuName) {
|
||||
_scriptMenuName = "Stop ";
|
||||
_scriptMenuName.append(scriptMenuName);
|
||||
_scriptMenuName.append(QString(" [%1]").arg(_scriptNumber));
|
||||
} else {
|
||||
_scriptMenuName = "Stop Script ";
|
||||
_scriptNumber++;
|
||||
_scriptMenuName.append(_scriptNumber);
|
||||
}
|
||||
_scriptNumber++;
|
||||
_menu = menu;
|
||||
_controllerScriptingInterface = controllerScriptingInterface;
|
||||
}
|
||||
|
@ -224,6 +225,7 @@ void ScriptEngine::run() {
|
|||
qDebug() << "Uncaught exception at line" << line << ":" << _engine.uncaughtException().toString();
|
||||
}
|
||||
}
|
||||
emit scriptEnding();
|
||||
cleanMenuItems();
|
||||
|
||||
// If we were on a thread, then wait till it's done
|
||||
|
|
|
@ -57,7 +57,9 @@ public slots:
|
|||
signals:
|
||||
void willSendAudioDataCallback();
|
||||
void willSendVisualDataCallback();
|
||||
void scriptEnding();
|
||||
void finished();
|
||||
|
||||
protected:
|
||||
QString _scriptContents;
|
||||
bool _isFinished;
|
||||
|
|
Loading…
Reference in a new issue