Click here to see simpleAnimationActivatedByClicking
Click here to see oneChatCommand in a multi user world
Click here to see twoChatCommands in a multi user world
To try out the examples upload all of the files from the
simpleChatCommands.zip to the web and set your browser to go to the contact.htm file.
First look at simpleAnimationActivatedByClicking.wrl and the code for it.
6 steps to make simpleAnimationActivatedByClicking.wrl activated by a chat command so that we end up with our example oneChatCommand.wrl
1/ Add the blaxxun PROTO BlaxxunZone containing the field groupChat
2/ Make an instance of the PROTO BlaxxunZone and DEFine it as SharedZone
3/ Add a script node that has a function for receiving the public chat
DEF script Script {
5/ Remove the line that is no longer needed
6/ Replace the ROUTE
ROUTE touchSensor.touchTime TO timeSensor.startTime with ROUTE script.chatTime TO timeSensor.startTime
Chat commands achieve the same results as shared events. Because all the people in the world receive the chat at the same time everyone's computers processes the commands that activate the animations at the same time.
Implementing shared events using chat commands can be simpler than using shared events that need the user to click on something. no objects have to be added to a world just to do the trivial task of activating a shared event and we need only one BlaxxunZone node to activate any number of events. To add more shared events to our world all we need to add is
Variations of the Above Example
These files must of course be set up as multi user chat worlds to work.
changeBackgroundColor.wrl first checks to see if the chat line looks like a url. If it does it send the url to the background texture urls
changeBackgroundTexture.wrl changes the colors of the background by saying the commands red, green or blue. More colors and commands can be easilly added to the code.
Chat command related links
PROTO BlaxxunZone [
exposedField MFString groupChat ""
]
{
Group {}
}
DEF SharedZone BlaxxunZone {
}
eventIn MFString receiveChat
eventOut SFTime chatTime
url "vrmlscript:
function receiveChat (str, time) {
if (str[0]=='rotate blue bar'){
chatTime=time;
}
}
"
}
4/ We need a ROUTE that sends all the public chat said by any one using the public chat window to the receiveChat function
ROUTE SharedZone.groupChat TO script.receiveChat
DEF touchSensor TouchSensor {}
else if (str[0]=='?'){/*do something*\}
to our receiveChat function which is demonstrated in twoChatComands.wrl
Home Page
Thyme's Avatars | Techuelife Island News
| Thyme's VRML Links | Thyme's
Simple VRML & Blaxxun Multi User Examples
Thyme's
VRML Tutorial | Thyme's
VRML performance tips | How I feel
about sharing my code
Seamless3d
Free VRML Editor | News
Update Request
Questions
or Comments