How can I use tables or other HTML code?


#1

I would like to display a table in my game. Actually, what I want to do is a kind of auto-mapper for the player, showing the areas that the player already visited. My game uses a 10x10 grid of areas, so I would like to create a table with 10x10 cells and show this to the player as his “map”.
I tried this with html standard table tags (<table>, <tr>, <td> and such) but these do not seem to work. Is there a way to get html running within ChoiceScript or any other way to display a table?


#2

Html would require plugins that can mess things up.
One work around would be making it a bunch of graphics, if there’s just certain areas one can visit after another.


#3

Hey, thanks for the quick reply. Well, graphics are not an option here. The player can move freely on the map and it would be unpredictable what would be displayed on the map. It has to be created programmatically.
If I cannot do it with tables, I could only do it with ASCII graphics, but this would require a fixed-sized font to work. Hm.


#4

CS is not designed to support it. Note that CS is designed with mobile in mind, and most of the time this will look terrible on mobile (hence, there’s no plan to support it either). Functionally floating the images left and just repeating them with *line_breaks at the tens is the easiest supported way. That way you only need three images from what you said (one for not visited, one for visited, and one for PC). Maybe 102 if you want an individual picture for each room.

Functionally, the ASCII approach would be the second easiest solution. I think all you need is to find and to the replaceBbCode function in ui.js (maybe dupe it somewhere else, I don’t recall of the top of my head), and add a <code> option to it (but at that point it’s no longer supported).


#5

Interesting, so I can display several images in a horizontal row? That might be a viable solution, I could create the sequence of images programmatically (of course this is not only about visited or not visited, each area has a terrain type and other characteristics, but these could be represented by icons if I could use images).

So if I use several *image commands successively (with left), the images will be displayed side by side until I use *line_break?


#7

IIRC, using *image command side by side will still push the consecutive images below the previous one.

Another trick to work this around, although a bit laborious, is to use Unicode’s bounding box characters and blank-spaces. But not sure if they’ll fit the screen if you plan to create a 10x10 grid, tho.


#8

I tried it now with several images, and they are indeed displayed side by side when you use the “left” directive, but the gaps between the images are too big so that this would be rather useless for displaying a map of sorts. Is there any way to reduce the gap between the images? It would be ideal if they could be displayed without any gap in between. Maybe some tweaking of the CSS?

Edit: I found a way to remove the horizontal gap by changing the alignleft class in the CSS! Yay! Now I just need to get rid of the vertical gap …


#9

Rule of hand with these things:

Do you really, really need an element in your game?
Will the story not work at all if it is removed?

Because changing the css can very easily screw up the ENTIRE game, making it unplayable.

EDIT: Easiest way I can think of, though it requires 100 variables if the grid’s 10 x 10, would be being clever with multireplace


#10

I hear you, MP, but what I want to create is a kind of open-world game, not a linear story. And I would like to find out if that can be done with ChoiceScript. My concept has a lot of story elements but not a linear storyline. It is more a game of management, exploration, and adventure.

Of course I need 100 variables for the 10x10 grid, and I am coding the area elements into these variables. For example, if the first letter is a P, this is a “Plains” area, F is forest and so on. The second letter contains a number which represents the kind of castle found in this area. And so on. All this can be done with ChoiceScript, though some of these things are quite tedious. Having proper array and string functions would help a lot.

And right now I am trying to find the best way to display this area map.


#11

Multireplace.
Because you’d already need a different variable for each image file, you might as well just have

@{a1 O|X}I@{a2 O|X}I@{a3 O|X}I@{a4 O|X}I@{a5 O|X}
*line_break
-------------------------------------------------
*line_break
@{b1 O|X}I@{b2 O|X}I@{b3 O|X}I@{b4 O|X}I@{b5 O|X}
*line_break
-------------------------------------------------
*line_break
@{c1 O|X}I@{c2 O|X}I@{c3 O|X}I@{c4 O|X}I@{c5 O|X}
*line_break
-------------------------------------------------
*line_break
@{d1 O|X}I@{d2 O|X}I@{d3 O|X}I@{d4 O|X}I@{d5 O|X}
*line_break
-------------------------------------------------
*line_break
@{e1 O|X}I@{e2 O|X}I@{e3 O|X}I@{e4 O|X}I@{e5 O|X}

which would display sorta like this:

XIXIXIXIX
---------
XIOIXIOIO <- if one visited those parts and the variable's been set true
---------
XIXIXIXIX
---------
XIXIXIXIX
---------
XIXIOIXIX

#12

I see what you mean, but this is not very reader-friendly. And as mentioned above, it requires a fixed font, with a standard proportional font it would not display well because characters have not the same width. Using graphics would be much better for readability, and I’d just need a small set of symbols if I just could make them display without gaps.


#13

not with a ten by ten grid.
either the grid would have to be too large, or it could not be adjusted if one increases the font size.

Seriously: drop the idea, it’s not going to work without likely making the game unplayable.


#14

Hmm, “drop the idea” is not exactly the encouraging answer I am looking for :slight_smile:

I think I’ll experiment a little more. Finding a viable way to do this would open a whole world of dungeon crawlers and similar games to be designed with Choicescript. But if it does not work (and if the question is allowed here), what other platform would be better for implementing such an idea?


#15

For dungeoncrawlers?
RPG Maker comes to mind.


#16

As a big fan of rogue-likes, and someone who generally likes to push a language’s limits, I support this idea, and would love to see what comes of it :wink:


#17

I was trying to do something similar not too long ago regarding a randomly generated star map, but unfortunately, without heavily modifying the code, I wasn’t able to produce a satisfactory result. In the end, I just settled for a list of stars and how far away they are from the current location.


#18

You’re trying to use a system to do something it wasn’t really designed for. That always means lots of work and, usually, not very satisfactory results. There’s always ‘renpy’, a python based system, if you’re looking for a more graphical story orientated language. Its flexibility is its strength, you can use python to do pretty much anything.


#19

Thanks for the input. I see nothing wrong with using a system for something new. If it does not work, I will live with the consequences. My game is still very story-heavy and text-oriented, therefore I consider CS not a bad choice. I also like the idea to have it published by CG one day, on different platforms, so that I don’t have to care for marketing, promoting, platform-independence and such stuff. I’m not sure if other systems would relieve me of this work.


#20

To be published and promoted by CoG you’d have to be contracted with them. Dunno the full specifics, but you’d be likely more likely to publish under HG, meaning beta testing, promotion etc all be your responsibility.