PDA

View Full Version : "Don't Fall" Conversion



Maverick05
12-14-2004, 07:20 AM
For part of a class assigment I created the "Don't Fall" game off the mxbook. On the school macs here, I can install and use Electroserver 3, but not 2, which don't fall was designed for. I read that it is possible to upgrade the games to work with 3. What do I need to do to accomplish that? Thanks. :confused:

daveganley
12-14-2004, 09:04 AM
It will be a matter of updating the ES commands/functions. Read the docs the came with ES3 and you'll see what the new one look like. If you get stuck, paste the old command/function and someone will be able to point you in the right direction of what it should be.

Have fun

Dave

Maverick05
01-11-2005, 04:05 AM
Ok, I'm a newbie at this, so I was wondering if anyone could help me in what I need to convert from electroserver 2 to 3 with these commands. Thanks.




if (ElectroServer == null) {
#include "ElectroServerAS.as"
}
stop();
function connectionResponse(success) {
if (success) {
chat.gotoAndStop("Login");
} else {
chat.gotoAndStop("Connection Failed");
}
}
function login(username) {
ES.login(username);
}
function loginResponse(success, reason) {
if (success) {
ES.joinRoom("Lobby");
chat.gotoAndStop("Chat");
chat.room.text = "Lobby";
} else {
chat.gotoAndStop("Login Failed");
chat.reason.text = reason;
}
}
function chatSend(info) {
ES.sendMessage(info, "room");
}
function messageArrived(info) {
var from = info.from;
var body = info.body;
var type = info.type;
if (type == "public") {
var msg = formatFrom(from)+": "+formatBody(body)+"
";
} else if (type == "private") {
var msg = formatFrom(from)+"[private]: "+formatBody(body)+"
";
}
chat.window.htmlText = ES.addToHistory(msg);
chat.bar.setScrollPosition(chat.window.maxscroll);
}
function formatFrom(from) {
return "<a href=\"asfunction:_root.privateMessage,"+from+"\">"+from+"</a>";
}
function formatBody(body) {
return ""+body+"";
}
function privateMessage(who) {
chat.popup3.who = who;
chat.popup3.gotoAndStop("Private Message");
}
function sendPrivateMessage(msg, who) {
ES.sendMessage(msg, who);
}
function roomListChanged(roomList) {
var path = chat.roomList;
path.removeAll();
path.setChangeHandler("roomClicked", _root);
for (var i = 0; i<roomList.length; ++i) {
var name = roomList[i].name;
var item = name+"("+roomList[i].total+")";
path.addItem(item, name);
}
}
function roomClicked(path) {
var name = path.getValue();
chat.room.text = name;
ES.joinRoom(name);
}
function createRoom(room) {
chat.room.text = room;
ES.joinRoom(room);
}
function userListChanged(userList) {
var path = chat.userList;
var enabled = path.getEnabled();
path.setEnabled(true);
path.removeAll();
path.setChangeHandler("personClicked", _root);
for (var i = 0; i<userList.length; ++i) {
path.addItem(userList[i].name);
}
path.setEnabled(enabled);
}
function personClicked(path) {
var name = path.getValue();
if (name != ES.username) {
chat.popup.gotoAndStop("Waiting");
chat.userList.setEnabled(false);
ES.challenge(name, "Don't Fall!");
}
}
function challengeReceived(from, game) {
var msg = from+" has just challenged you to a game of "+game+"!";
chat.userList.setEnabled(false);
chat.popup.gotoAndStop("Challenged");
chat.popup.msg.text = msg;
}
function challengeAnswered(response) {
if (response == "accepted") {
_root.gotoAndStop("Game");
} else if (response == "declined") {
chat.popup.gotoAndStop("Declined");
chat.popup.msg.text = "The challenge has been declined.";
} else if (response == "autodeclined") {
chat.popup.gotoAndStop("Declined");
chat.popup.msg.text = "The challenge has been automatically declined.";
}
chat.userList.setEnabled(true);
}
function acceptChallenge() {
chat.userList.setEnabled(true);
chat.popup.gotoAndStop(1);
ES.acceptChallenge();
this.gotoAndStop("Game");
}
function declineChallenge() {
chat.userList.setEnabled(true);
chat.popup.gotoAndStop(1);
ES.declineChallenge();
}
function cancelChallenge() {
ES.cancelChallenge();
chat.userList.setEnabled(true);
}
function challengeCancelled() {
chat.userList.setEnabled(true);
chat.popup.gotoAndStop("Cancelled");
}
//Configure the ElectroServer object
if (!ES.isConnected) {
ES = new ElectroServerAS();
}
ES.ip = "localhost";
ES.onConnection = this.connectionResponse;
ES.loginResponse = this.loginResponse;
ES.chatReceiver = this.messageArrived;
ES.roomListChanged = this.roomListChanged;
ES.userListChanged = this.userListChanged;
ES.challengeReceived = this.challengeReceived;
ES.challenge