This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CLOUDPARTY GIST (smoosh together for searchability) | |
//////////////////////////// set global state examples //////////////////////////////////// | |
setGlobalState({ | |
state_key: 'Racetrack Key', | |
data: { controller: getSelfEnt() } //controller announce yo sef to da worl! | |
}); | |
setGlobalState({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ARRAY SORT CLOUDPARTY cloudparty | |
// Sort the total and current results lists by time | |
arraySort(resultsTotalArray, 'sortByTime'); | |
arraySort(resultsCurrentArray, 'sortByTime'); | |
// Sort the total and current results lists by time | |
arraySort(resultsCurrentArray, 'sortByTime'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//cloudparty array to object and object to array | |
///////////////////////////////////////////////////////////////////////////////////////////// | |
//array to object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function spawnTeleport(entFieldsData) { | |
error('Got ' + entFieldsData.display_name + '\'s position at ' + stringify(entFieldsData.pos, {newline: false, indent: false})); | |
vecPosWorldToRel(entFieldsData.pos); | |
vecAdd(entFieldsData.pos, []); | |
spawn({ | |
prefab: 'Timeout Prefab', | |
pos: entFieldsData.pos | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closing Controllers | |
How do you close a controller under script control? I thought I had that figured out at one point, but I guess not. | |
Yeah, that one is definitely a little subtle. Look at the 'command' section under listeners on controllerHTMLCreate: | |
http://wiki.cloudparty.com/wiki/ControllerHTMLCreate#listeners_Element_Keys | |
Basically you want to create a listener that has command: 'close', and then send a message (controllerMessage) corresponding to that listener. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var htmlText = '<div id="body">\ | |
<div id=btnGrp>\ | |
<button id="btnClose">Close the Dialog</button><br>\ | |
</div></div>'; | |
function clickStart() { | |
controllerHTMLCreate({ | |
ent: getMessageEnt(), | |
title: 'the winow title', | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{id:'hi',name:'ho'}}, | |
{{id:'hi',name:'ho'}}, | |
{{id:'hi',name:'ho'}}, | |
{{id:'hi',name:'ho'}}, | |
{{id:'hi',name:'ho'}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Controller- Entity Communication Design | |
1. Placed Entities (e.g. race checkpoints) use a register.js script to register themselves into the database--with registration retry logic built in. | |
(Registration is into global state with key.) | |
2. Controller periodically queries global state for the array of keys of entites. | |
3. Controller direct messages a Report! command to each entity on the list.(so errors can be returned) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updatedData(globalStateData) { | |
error('Updated with ID: ' + getSelfEnt()); | |
} | |
setGlobalState({ | |
state_key: 'DM Key', | |
data: { gameObjects: { asset_c_nick: getSelfEnt() } }, | |
callback: 'updatedData' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>CLOUD PARTY SCRIPTING PAGES</title> | |
<style type="text/css"> | |
.tbl-left { | |
text-align: left; | |
padding: 4em; | |
font-size: 1.2em; | |
font-family: helvetica, arial; |
OlderNewer