Simple Table

Ok. So I created a function to display a simple table of info. I thought it was straight forward, but I am having an issue. Here is the code:

msg ("<table style=\"width:50%\"><br/>  <tr><br/>    <th>Letter</th><br/>    <th>1</th><br/>    <th>2</th><br/>    <th>3</th><br/>    <th>4</th><br/>    <th>5</th><br/>    <th>6</th><br/>    <th>7</th><br/>    <th>8</th><br/>  </tr><br/>  <tr><br/>    <td>A</td><br/>    <td>{if game.StoryPointA1=True:T}{if game.StoryPointA1=False:F}</td><br/>    <td>{if game.StoryPointA2=True:T}{if game.StoryPointA2=False:F}</td><br/>    <td>{if game.StoryPointA3=True:T}{if game.StoryPointA3=False:F}</td><br/>    <td>{if game.StoryPointA4=True:T}{if game.StoryPointA4=False:F}</td><br/>    <td>{if game.StoryPointA5=True:T}{if game.StoryPointA5=False:F}</td><br/>    <td>{if game.StoryPointA6=True:T}{if game.StoryPointA6=False:F}</td><br/>    <td>{if game.StoryPointA7=True:T}{if game.StoryPointA7=False:F}</td><br/>    <td>{if game.StoryPointA8=True:T}{if game.StoryPointA8=False:F}</td><br/> </tr><br/></table> ")

When I run the program and run that it puts several blank lines between the 2 messages. So what am I doing wrong?


Ok. Not sure what the problem is. I have tried posting this using the suggested "```" but when I try to post it the stupid thing says "You can't post this here." So, basically I have two messages. One that posts a simple message and one that should create a table. It does that, no problem, but it puts like 10 blank lines between the two messages. I would just like one message followed by the table. How do I fix that?


Try removing all the <br/> from it. They do not belong in a table, and I think it is extracting them, and showing them first, and then showing the table.

What you could do is construct a string stepwise, and then display that, which would save you having a line that spreads across six monitors. And then you could use looping. And that would mean you could change the number of columns and the letter...

count = 8
letter = "A"
s = "<table style=\"width:50%\"><tr><th>Letter</th>"
for (i, 1, count) {
  s = s + "<th>" + i + "</th>"
}
s = s + "</tr><tr><td>" + letter + "</td>"
for (i, 1, count) {
  s = s + "<td>{either game.StoryPoint" + letter + i + ":T|F}</td>"
}
s = s + "</table>"
msg(s)

That did it. Thanks!


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

Support

Forums