I still don't really understand what you're talking about.
However, I decided to post a script that might be useful to you (or others).
It's the crystal script from my still not finished single player version of OrigamiBots.
//
// crystal SCRIPT
//
// This is a crystal object that sends a message to the course script, which then increases the crystal variable by one.
// It can be turned on/off using messages and can send a message to the course script when picked up (for example triggering movements, etc.)
// Spot parameters are:
// 0 - standard off? (0 or 1)
// 1 - send message on pickUp? (0 or 1)
// 2 - message id (id of message to send if the above is 1)
var off;
var msgOn;
var msgId;
// CONSTRUCT
function crystalConstruct(obj) {
obj.setting.contact=true; //contact with other models
obj.setting.pickUp=true; //can be picked up
obj.model.on=true; //has a model
obj.model.lit=DIM3_MODEL_LIT_VERTEX; //vertex lighting to make it look goooood :P
obj.model.name='crystal'; //model name
obj.model.offset.y=-500; //float in the air, 500 model units above ground
obj.model.bounce=true; //bounce up and down
obj.model.spin.y=3; //spin around y-axis
}
// PICKUP
function crystalPickUp(obj) { //upon pickup
obj.event.sendMessageToCourse(301); //send a message to the course script to increase score
if (msgOn) obj.event.sendMessageToCourse(msgId); //if set to true in the parameter, send another message to course script
obj.setting.contact=false; //no more collision
obj.setting.hidden=true; //hide the object
obj.setting.pickUp=false; //you can't pick it up again
}
// MESSAGE
function crystalMessage(obj,subEvent,id) { //when receiving a message
switch(id) { //act depending on the id of the message
case 1: //1 = activate the crystal
off = 0; //it's not off
obj.setting.hidden=false; //not hidden
obj.setting.contact=true; //and contact = true
return;
case 2: //2 = deactivate it
off = 1; //it's off
obj.setting.hidden=true; //hidden
obj.setting.contact=false; //and has no collision
return;
}
}
// SPAWN
function crystalSpawn(obj) {//when spawning
off = parseInt(obj.setting.getParameter(0)); //get the object parameter
if(off) obj.setting.hidden=true; //and turn the object off, if needed
msgOn = parseInt(obj.setting.getParameter(1)); //parse some integers and set variables
if(msgOn) msgId = parseInt(obj.setting.getParameter(2)); //lol
}
// EVENT
function event(obj,mainEvent,subEvent,id,tick) {
switch (mainEvent) {
case DIM3_EVENT_CONSTRUCT:
crystalConstruct(obj);
return;
case DIM3_EVENT_SPAWN:
crystalSpawn(obj);
return;
case DIM3_EVENT_MESSAGE:
crystalMessage(obj,subEvent,id);
return;
case DIM3_EVENT_PICKUP:
crystalPickUp(obj);
return;
}
}