iiYO Community

Full Version: Change the background textbox color of each speaking character
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3

Guest

Hi brg,

please try adding a
Code:
console.log(obj);
to Game.prototype.load after
Code:
self.ws = obj.responseXML;
and look for the responseXML and responseText properties in the output. It could be that for some reason one server thinks the game file is an XML file while the other one doesn't. Then responseXML, which is used in the code, would probably be null.

Guest

brg Wrote:I noticed the old WSE code uses "out.Game" to define several functions and the new WSE code uses just "Game" is used in the old code.

That's because WSE now uses a module system, so there's no need for putting everything in a global
Code:
WSE
(which is
Code:
out
in this case) variable. So
Code:
WSE.Game
is no longer global but the name of a module.

Guest

Hi C7N,

Thank you for explaining why the global WSE is no longer needed Smile.

For console.log(obj):
Code:
XMLHttpRequest
onabort: null
onerror: null
onload: null
onloadend: null
onloadstart: null
onprogress: null
onreadystatechange: ()
ontimeout: null
readyState: 4
response: "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> //rest of game.xml
responseText: "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> //rest of game.xml
responseType: ""
responseURL: "http://localhost:8080/game.xml?random=0.43476768652908504"
responseXML: null
status: 200
statusText: "OK"
timeout: 0
upload: XMLHttpRequestUpload
withCredentials: false
__proto__: XMLHttpRequest
For console.log("Response XML: " + obj.responseXML):
Code:
Response XML: null

Guest

Thanks. That is what I was expecting...

It seems that either your server reports the wrong MIME type for the game.xml file or for some reason the file is corrupted and cannot be parsed to XML. If you use Chrome you can check the HTTP headers of the server response in the network tab to see which MIME type it reports.

Here's what it should look like:

[Image: A2ZE3CQ.png]

Guest

Thank you, this is what chrome reports:

Code:
Response Headers
Accept-Ranges:bytes
Content-Disposition:attachment; filename="game.xml";
Content-Length:2607
Content-Type:application/octet-stream
Last-Modified:Thu, 17 Sep 2015 21:29:28 GMT
Server:HFS 2.3f

So, it feels the xml file is an octet-stream because it thinks the game.xml file definition is ambiguous..I"m guessing.

game.xml is defined as:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

Guest

As far as I can tell, there's nothing wrong with the game.xml file's content. I ran it through a validator and it's well-formed (XML jargon for valid).

From the headers you posted it seems your server tries to force the browser to download the file with
Code:
Content-Disposition:attachment;
. That is usually not what you want for text-based files. Frankly, it seems to me that your server behaves a little weird here.

From what I read on their website, the server's purpose is to share files by downloading them via HTTP, so it seems it's not meant to be used as a full web server:

Quote:"You can use HFS (HTTP File Server) to <b>send and receive files</b>."

Why don't you use the Python server module or http-server with Node.js or something similar?

I don't know why this server worked for you before, but it doesn't seem to be a bug in WSE.

Guest

Thanks, we went with HFS because we needed a webserver immediately that was virtual. It is interesting that HFS was somehow working with previous versions of WSE throughout the years. I decided to try out iis inside of windows, that worked just fine. I can now view and test out the changes you made for character background color, thank you for your help. I'll post an update on my findings later today Big Grin

Guest

The color changes are not working for me but I know it is probably a mistake on my end with CSS. I'm attempting to change character Bill, background textbox blue.

In game.xml, I added the following character and implemented it correctly:
Code:
<character name="b" textbox="tb_main">
        <displayname>Bill</displayname>
    </character>

        <scene id="start">
                <show asset="tb_main" />
            <line s="b">
                Hello, my name is Bill!
            </line>
    </scene>
For default.css:
Code:
.wse_character_b
{
    background: rgba(0, 0, 200, 0.8);
}

Guest

Does this work?

Code:
.textbox.wse_character_b

If not you probably have defined the background for the textbox by ID somewhere and so the CSS for the class is discarded.

Guest

Yes, that works great thank you!!! Big Grin
I hope others are able to make use of the color changes as well Big Grin
Pages: 1 2 3