Jump to content




Quest/CCML Mega-Tutorial


  • You cannot reply to this topic
25 replies to this topic

#1 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 04 November 2014 - 07:06 AM

For more information about Quest and the download link check out this topic.

This is going to be another fairly large tutorial. If you haven’t already seen it, you should checkout Quest. Simply put, it’s an HTML(ish) web browser which functions as close to a standard web browser as I could realistically make it in ComputerCraft given the screen space, storage space, character size and HTTP limitations that exist. You can use things like PHP, Node.JS, or even ASP if you’re strange enough. You can also make plain old static web pages, which is where we will start.

Even if you’ve made tons of HTML pages before, there are a number of notable differences. However, I’ve tried to make everything as close as possible to HTML, you’d be rather surprised how much is identical. In fact, if you haven’t used HTML before I’d recommend learning the basics somewhere else first, I’m going to be fairly specific about the differences rather than teaching from scratch.

Creating Your First Page

Using Element Attributes

Making a Wi-Fi Server

Creating Links

Creating Images

Center Elements

Inline Elements/Floats

Forms

File Uploading

LuaScript/lQuery

Edited by oeed, 04 November 2014 - 09:46 AM.


#2 TheEvilSocks

  • Members
  • 22 posts

Posted 11 November 2014 - 01:24 PM

Man I love this already!

Is there a way to make (mysql) databases?

EDIT:
Also, do cookies work? I can't get them to work.

Edited by TheEvilSocks, 11 November 2014 - 01:32 PM.


#3 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 11 November 2014 - 08:55 PM

View PostTheEvilSocks, on 11 November 2014 - 01:24 PM, said:

Man I love this already!

Is there a way to make (mysql) databases?

EDIT:
Also, do cookies work? I can't get them to work.
If you use a web server that has MySQL then yes.

Cookies don't work, although I made a substitute. However, it looks like I forgot that section. I'll try and write it up today.

#4 deletedededed

  • Members
  • 13 posts
  • LocationThe Internet

Posted 17 November 2014 - 01:26 AM

Thanks for the help, I've been trying to get a "Center tag" working for a long time, If only I could understand lua this fluently.

#5 willwac

  • Members
  • 182 posts

Posted 19 November 2014 - 12:00 AM

I'm putting this on GitHub

#6 superkiller4456

  • New Members
  • 1 posts

Posted 19 January 2015 - 03:03 AM

I want to make a small website so it lists different lines of text.
but i also want to make it so i can submit a text to from the same site.
any help?

#7 dueckers5

  • Members
  • 23 posts

Posted 31 January 2015 - 06:03 AM

You should make it so much simpler to use! I READ IT ALL and im still confused! Try making a video

#8 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 31 January 2015 - 05:13 PM

What's so confusing? It's pretty much basic HTML.

#9 Rougeminner

  • Members
  • 151 posts

Posted 26 February 2015 - 10:30 PM

View Postdueckers5, on 31 January 2015 - 06:03 AM, said:

You should make it so much simpler to use! I READ IT ALL and im still confused! Try making a video

I will help u where you need it just please PM me on my account page. sorry i have no vid though

#10 _removed

  • Members
  • 262 posts

Posted 19 April 2015 - 02:42 PM

Wait a minute, This can connect to real webpages? So I can have a webpage on the internet?

#11 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 19 April 2015 - 02:57 PM

Yeah, but it won't parse normal HTML, and normal browsers won't be able to parse CCML.

#12 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 19 April 2015 - 04:11 PM

Do note that you can very easily make any existing webpage work with Quest. By default, Quest searches for files ended with .ccml, so you can have an index.html for your main webpage and an index.ccml for Quest main page.

#13 biggest yikes

  • Members
  • 573 posts

Posted 24 April 2015 - 11:33 PM

Still no LuaScript tutorial? :(
I know it exists, this code is valid..
<head>
<title>Is LuaScript supported?</title>
<script type="lua">
  l('p').text("Luascript is supported!")
</script>
</head>
<body>
  <p width="48">LuaScript is not supported; update Quest!</p>
</body>
EDIT: Figured it out, it's basically just a sandboxed lua environment that has a few special functions, a "window" table, and the "l" (L) function to set the text of elements and such.

Edited by Atenefyr, 26 April 2015 - 02:27 PM.


#14 Fetchetch

  • Validating
  • 24 posts

Posted 02 May 2015 - 04:31 PM

So from what the app is saying, to use PHP you need to host it off of your own server.
What would be a way to host it off of a web server? (e.g. change
253 local questHost = 'http://quest.net76.net/sites/'
to
253 local questHost = 'http://somewebserver.net/sitedir/'
)

I did try that using 000webhost but i only got error code 2 (incorrect doctype) every time i load a page.

Edit 1: Also, how would a user download a file? By linking it? (e.g.
<a href="example.txt">example</a>
) and it would download?

Edited by Fetchetch, 02 May 2015 - 06:05 PM.


#15 Lignum

  • Members
  • 558 posts

Posted 03 May 2015 - 02:36 PM

View PostFetchetch, on 02 May 2015 - 04:31 PM, said:

I did try that using 000webhost but i only got error code 2 (incorrect doctype) every time i load a page.

Add <!DOCTYPE ccml> at the top of your ccml file.

View PostFetchetch, on 02 May 2015 - 04:31 PM, said:

Edit 1: Also, how would a user download a file? By linking it? (e.g.
<a href="example.txt">example</a>
) and it would download?

Yes, that should work.

#16 biggest yikes

  • Members
  • 573 posts

Posted 03 May 2015 - 07:53 PM

View PostFetchetch, on 02 May 2015 - 04:31 PM, said:

So from what the app is saying, to use PHP you need to host it off of your own server.
What would be a way to host it off of a web server? (e.g. change
253 local questHost = 'http://quest.net76.net/sites/'
to
253 local questHost = 'http://somewebserver.net/sitedir/'
)
If you do that, then the ".qst" domain will direct to your website instead. To access your webpage, all you need to do is type the URL into your address bar. (Doesn't work for some webpages, like Github, because they don't function with post requests).
Yes, to use PHP you have to host the PHP files on your own server.

View PostFetchetch, on 02 May 2015 - 04:31 PM, said:

-snip-
I did try that using 000webhost but i only got error code 2 (incorrect doctype) every time i load a page.
CCML has an extremely strict format. In your case, the first line in your HTML document MUST be "<!DOCTYPE ccml>", or else it refuses to load. If you're using PHP, before you begin your PHP code (<?php), put <!DOCTYPE ccml>, like this:
<!DOCTYPE ccml>
<?php
myphpcode
?>

View PostFetchetch, on 02 May 2015 - 04:31 PM, said:

Edit 1: Also, how would a user download a file? By linking it? (e.g.
<a href="example.txt">example</a>
) and it would download?
If you click a link and the file extension isn't ccml, html, php, asp, aspx, jsp, qst, com, me, net, info, au, or nz, it'll download it automatically. ".txt" will automatically download, so in that case if the user clicked "example" it would indeed download the file "example.txt".

Edited by Atenefyr, 03 May 2015 - 08:05 PM.


#17 Piorjade

  • Members
  • 244 posts
  • LocationComputer, Germany

Posted 18 October 2015 - 12:25 AM

Am I stupid or why does the file "test.php" not work on Quest:
<!DOCTYPE ccml>
<?php
echo "Hello World";

?>

It just gives me the error: WebView (Bedrock API):19: attempt to index ? (a nil value)

#18 Konlab

  • Members
  • 595 posts
  • LocationKerbin

Posted 18 October 2015 - 01:02 PM

View PostPiorjade, on 18 October 2015 - 12:25 AM, said:

Am I stupid or why does the file "test.php" not work on Quest:
<!DOCTYPE ccml>
<?php
echo "Hello World";

?>

It just gives me the error: WebView (Bedrock API):19: attempt to index ? (a nil value)
Php is a server side language. It is executed on the server. Quest gets only HTML, not PHP.
Edit: Are you using a custom server? Or oeed's hosting (no php support when using this)

Edited by Konlab, 18 October 2015 - 01:06 PM.


#19 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 18 October 2015 - 08:58 PM

View PostKonlab, on 18 October 2015 - 01:02 PM, said:

View PostPiorjade, on 18 October 2015 - 12:25 AM, said:

Am I stupid or why does the file "test.php" not work on Quest:
<!DOCTYPE ccml>
<?php
echo "Hello World";

?>

It just gives me the error: WebView (Bedrock API):19: attempt to index ? (a nil value)
Php is a server side language. It is executed on the server. Quest gets only HTML, not PHP.
Edit: Are you using a custom server? Or oeed's hosting (no php support when using this)

Just to point out, PHP does work in the normal fashion. Whilst it is server side, it should be sending the CCML as normal.

I think the issue is your code is missing a <p> tag. The Quest HTML renderer is pretty terrible and doesn't just support text anywhere. I think you probably also need the <html> and <body> tags, checkout the main tutorial.

#20 Piorjade

  • Members
  • 244 posts
  • LocationComputer, Germany

Posted 23 October 2015 - 01:41 PM

I tried it with the <html> and <body> tags, this time it does not show the error but just shows nothing.
And I'm using 000webhost. (I tested the code in a real browser and it works, as expected.)

Here the code:



<!DOCTYPE ccml>
<html>
<head>
<title>TestSite</title>
</head>

<body>

<br>

<h> Test </h>

<br>

<p width="46" align="center">
Test
</p>

<br>

<?php
echo "Hello World";
?>

<br>

</body>

</html>


So when i try to get to the site it shows the normal HTML code ("Test" and "Test") but then no "Hello World" and no error.

Ohhhh i tried the <p> tag and now it worked :o/>
Thx oeed. :)/>





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users