2021-03-07 21:02:38 +01:00
|
|
|
console.log('SCRIPT LAUNCHED');
|
2021-03-11 10:58:48 +01:00
|
|
|
//WA.sendChatMessage('Hi, my name is Poly and I repeat what you say!', 'Poly Parrot');
|
2021-03-12 16:39:29 +01:00
|
|
|
var isFirstTimeTuto = false;
|
|
|
|
var textFirstPopup = 'Hey ! This is how to open start a discussion with someone ! You can be 4 max in a booble';
|
|
|
|
var textSecondPopup = 'You can also use the chat to communicate ! ';
|
|
|
|
var targetObjectTutoBubble ='tutoBobble';
|
|
|
|
var targetObjectTutoChat ='tutoChat';
|
|
|
|
var popUpExplanation = undefined;
|
|
|
|
function launchTuto (){
|
|
|
|
WA.openPopup(targetObjectTutoBubble, textFirstPopup, [
|
|
|
|
{
|
|
|
|
label: "Next",
|
|
|
|
className: "normal",
|
|
|
|
callback: (popup) => {
|
|
|
|
popup.close();
|
2021-03-07 21:02:38 +01:00
|
|
|
|
2021-03-12 16:39:29 +01:00
|
|
|
WA.openPopup(targetObjectTutoChat, textSecondPopup, [
|
|
|
|
{
|
|
|
|
label: "Open Chat",
|
|
|
|
className: "normal",
|
|
|
|
callback: (popup1) => {
|
|
|
|
WA.sendChatMessage("Hey you can talk here too ! ", 'WA Guide');
|
|
|
|
popup1.close();
|
|
|
|
WA.enablePlayerControl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
WA.disablePlayerControl();
|
|
|
|
|
|
|
|
}
|
2021-03-07 21:02:38 +01:00
|
|
|
WA.onChatMessage((message => {
|
|
|
|
console.log('CHAT MESSAGE RECEIVED BY SCRIPT');
|
|
|
|
WA.sendChatMessage('Poly Parrot says: "'+message+'"', 'Poly Parrot');
|
|
|
|
}));
|
2021-03-08 18:57:59 +01:00
|
|
|
|
|
|
|
WA.onEnterZone('myTrigger', () => {
|
|
|
|
WA.sendChatMessage("Don't step on my carpet!", 'Poly Parrot');
|
|
|
|
})
|
|
|
|
|
2021-03-11 10:58:48 +01:00
|
|
|
WA.onLeaveZone('popupZone', () => {
|
2021-03-08 18:57:59 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
WA.onEnterZone('notExist', () => {
|
|
|
|
WA.sendChatMessage("YOU SHOULD NEVER SEE THIS", 'Poly Parrot');
|
|
|
|
})
|
2021-03-09 16:21:14 +01:00
|
|
|
|
|
|
|
WA.onEnterZone('popupZone', () => {
|
2021-03-12 16:39:29 +01:00
|
|
|
WA.displayBubble();
|
|
|
|
if (!isFirstTimeTuto) {
|
|
|
|
isFirstTimeTuto = true;
|
|
|
|
launchTuto();
|
|
|
|
}
|
|
|
|
else popUpExplanation = WA.openPopup(targetObjectTutoBubble,'Do you want to review the explantion', [
|
2021-03-09 16:21:14 +01:00
|
|
|
{
|
2021-03-12 16:39:29 +01:00
|
|
|
label: "No",
|
2021-03-11 10:58:48 +01:00
|
|
|
className: "normal",
|
2021-03-09 18:51:30 +01:00
|
|
|
callback: (popup) => {
|
|
|
|
popup.close();
|
2021-03-12 16:39:29 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Yes",
|
|
|
|
className: "normal",
|
|
|
|
callback: (popup) => {
|
|
|
|
popup.close();
|
|
|
|
launchTuto();
|
2021-03-09 16:21:14 +01:00
|
|
|
}
|
|
|
|
}
|
2021-03-12 16:39:29 +01:00
|
|
|
])
|
2021-03-11 10:58:48 +01:00
|
|
|
});
|
2021-03-09 16:21:14 +01:00
|
|
|
|
2021-03-12 16:39:29 +01:00
|
|
|
WA.onLeaveZone('popupZone', () => {
|
|
|
|
if (popUpExplanation !== undefined) popUpExplanation.close();
|
|
|
|
WA.removeBubble();
|
|
|
|
})
|