Outerra forum

Anteworld - Outerra Game => Modding: Importer, Tools & Utilities => JavaScript development => Topic started by: SteelRat on April 13, 2015, 10:00:45 am

Title: Message box
Post by: SteelRat on April 13, 2015, 10:00:45 am
Hi developers!

What am I doing wrong?

Code: [Select]
<!DOCTYPE html>
<html>
<head>
    <title>Template msg box</title>

    <link type="text/css" rel="stylesheet" href="file:///www/css/outerra-theme.css">
    <script type="text/javascript" src="file:///www/lib/ot.js"></script>

    <script type="text/javascript">
        outerra({
            requires: [
                'file:///www/lib/component/message-box/message-box.js'
            ],

            body: function (ot, script) {
                var msgBox = new ot.components.ext.MessageBox('msgBox', {

// public api
//afterAction: undefined, // function (buttonId) {

                                        // public params
allowHtml: true,
title: 'Template msg box',
message: '<h4>Message Test</h4>',
buttons: 'CANCEL|NO|YES' // pipe separated button names e.g. 'CANCEL|NO|YES'
                });
                msgBox.render();
            }
        });
    </script>
</head>
<body></body>
</html>

if
Code: [Select]
<link type="text/css" rel="stylesheet" href="file:///www/css/outerra-theme.css">https://onedrive.live.com/redir?resid=BA7B7E2655BF556D!1605&authkey=!ANTKdVg5FW0OUhU&v=3&ithint=photo%2cjpg

else if
Code: [Select]
<link type="text/css" rel="stylesheet" href="file:///www/css/outerra.css">https://onedrive.live.com/redir?resid=BA7B7E2655BF556D!1606&authkey=!AP6qZPvTy2MbAQ4&v=3&ithint=photo%2cpng
Title: Re: Message box
Post by: PytonPago on April 13, 2015, 11:40:49 am
Wow, didnt know you can do your own windows  ...
Title: Re: Message box
Post by: SteelRat on April 13, 2015, 12:13:03 pm
Wow, didnt know you can do your own windows  ...

create folder in
Code: [Select]
InstallPach\outerra\Anteworld\MyDesktops
create file in folder
Code: [Select]
myDesktop.html
insert in file this
Code: [Select]
<!DOCTYPE html>
<html>
<head>
    <title>Template Desktop</title>

    <link type="text/css" rel="stylesheet" href="file:///www/css/outerra-theme.css">

    <script type="text/javascript" src="file:///www/lib/ot.js"></script>

    <script type="text/javascript">
        outerra({
            requires: [
                'file:///www/lib/component/desktopwindow.js'
            ],

            body: function (ot, script) {
                var win = new ot.components.DesktopWindow('win', {

    title = "Template Desktop",

    width: 500,
    height: 500,
                    minWidth: 100,
                    minHeight: 100,

                    populateBody: function (body) {
                        body.add(new ot.components.Component('body'));
                    }
                });
                win.render();
            }
        });
    </script>
</head>

<body class="window-body full-size">
<div cid="body">
    BODY
</div>
</body>
</html>

write in console
Code: [Select]
var win = window.open("../MyDesktops/myDesktop.html"); close();press ENTER)
Title: Re: Message box
Post by: PytonPago on April 13, 2015, 01:21:40 pm
That will be handy ... thanks !
Title: Re: Message box
Post by: Uriah on April 13, 2015, 01:24:46 pm
Awesome work SteelRat! This is extremely helpful!!!

Think there is a way to call this from an aircraft/vehicle .js script?
Title: Re: Message box
Post by: PytonPago on April 13, 2015, 01:53:56 pm
Awesome work SteelRat! This is extremely helpful!!!

Think there is a way to call this from an aircraft/vehicle .js script?


Well need a special button for that - a object info button !
Title: Re: Message box
Post by: SteelRat on April 13, 2015, 02:31:51 pm
Awesome work SteelRat! This is extremely helpful!!!

Think there is a way to call this from an aircraft/vehicle .js script?

It will be more difficult!
In aircraft/vehicle .js not metod
Code: [Select]
window.open();But I will find a way)
Title: Re: Message box
Post by: Uriah on April 13, 2015, 03:31:09 pm
That would be great! I believe cameni once mentioned that it would be possible.

Regards,
Uriah
Title: Re: Message box
Post by: SteelRat on April 13, 2015, 06:38:03 pm
That would be great! I believe cameni once mentioned that it would be possible.

Regards,
Uriah

I think I should be an interface.
Title: Re: Message box
Post by: zzz on April 15, 2015, 11:49:05 am
Cameni mentioned you could access the console from the js files

Code: [Select]
var world = this.$query_interface("ot::js::world.get");
var vehicle = world.create_instance("outerra/ddg/ddg", pos, {x:0, y:0, z:0, w:1}, false);

I was going to see if I could find a way to get the get_hpr() command to return in a js file tonight.
Title: Re: Message box
Post by: SteelRat on April 15, 2015, 12:04:52 pm
Solved the problem.

Code: [Select]
<!DOCTYPE html>
<html>
<head>
    <title>Message box sample</title>

    <link type="text/css" rel="stylesheet" href="file:///www/css/outerra-theme.css">
    <script type="text/javascript" src="file:///www/lib/ot.js"></script>

    <script type="text/javascript">
var msg = "<p><h3>Hi!</h3></p>";
msg += "<p>My name is Outerra user interface.<p>";
msg += "<p>Welcome to the sandbox.<p>";
msg += '<img src="http://www.outerra.com/webackx.png" width="90%">';

        outerra({
            requires: [
                'file:///www/lib/component/message-box/message-box.js'
            ],

            body: function (ot, script) {
                var msgBox = new ot.components.ext.MessageBox('msgBox', {

// public api
afterAction: function (buttonId) {
close();
},

height: 240,
maxHeight: 240,

                        // public params
allowHtml: true,
title: 'Message box sample',
message: msg,
buttons: 'YES' // pipe separated button names e.g. 'CANCEL|NO|YES'
                });
                msgBox.render();
            }
        });
    </script>
</head>
<body class="window-body full-size">

</body>
</html>

https://onedrive.live.com/redir?resid=BA7B7E2655BF556D!1607&authkey=!AHgeT3t1Q649Krk&v=3&ithint=photo%2cjpg
Title: Re: Message box
Post by: SteelRat on April 15, 2015, 12:19:09 pm
Cameni mentioned you could access the console from the js files

Code: [Select]
var world = this.$query_interface("ot::js::world.get");
var vehicle = world.create_instance("outerra/ddg/ddg", pos, {x:0, y:0, z:0, w:1}, false);

I was going to see if I could find a way to get the get_hpr() command to return in a js file tonight.

http://pastebin.com/j2YXqj7H

I'm here about another, or I do not understand.)