HTML Tables

I'm working on creating a 'book' object in which I want to list items, pages, etc. I'm able to work my way through the code to display what I want and when I want it.

But...

I'm struggling with getting formatting on the output text. I want to be able to create a HTML table layout or something similar. But when using HTML in the message output, tables seem to be getting stripped out of the code.

Any ideas on how to get to the end product here, whether HTML or in some other way?

Thanks for the help in advance. :)


I can't see any reason why tables wouldn't work. Just tested it with a couple of examples, and they seem to work fine.

Can you show some of the code you're using, or link to an example game, so we can take a closer look at it?

Oh… another thought. Are you doing something like this?

msg ("<table>")
msg ("<tr><th>Some heading</th><th>Another heading</th></tr>")
[···etc···]
msg ("</table>")

That's the first thing that comes to mind that wouldn't work. Because every msg() is wrapped between <span style="some stuff"> and </span>; so in this case your <table> tag would be closed immediately because its containing element ends, and the table body cells end up outside of the table.

If you're doing something like that, it would need to be:

table = "<table>"
table = table + "<tr><th>Some heading</th><th>Another heading</th></tr>"
[···etc···]
table = table + "</table>"
msg (table)

so that the whole table is inside the same msg(). This will apply to any custom HTML you output; the opening and closing tags must be in the same call to msg.


That was the problem. I was placing it all in the message tags. Once inside a variable it worked correctly!

Awesome, thanks mrangle. :)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums