Dont understand this no more

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Dont understand this no more

Post by aliasmask »

Chkoupi wrote:Edit2: I think i can use am.watch now but i dont know what to do with (tried [H:am.watch("CharSheet@Lib:CharSheet")] got an error  
Error
Error in body of roll.
      Statement options (if any): H
      Statement Body : am.watch("CharSheet@Lib:CharSheet")
For future reference, the function is only designed to display variables. So, "CharSheet@Lib:CharSheet" is not the name of a variable but a macro, so it has no value to display.

User avatar
Chkoupi
Kobold
Posts: 9
Joined: Wed Jul 08, 2015 5:13 pm
Location: Tlemcen, Algeria
Contact:

Re: Dont understand this no more

Post by Chkoupi »

There the last version of my test campaign, is was doing the map an stuff on another campaign (which is not important), the thing i was basically trying to do is a simple but very long char sheet that contains the same info as this :
Spoiler
Image
But without all the cases, i wanted to put one single case after each original value (in the Prop files i did a version that has B at the end (B for Base) of each stat to contain the base stats) where we could type a change of the stat (for example someone has 8 base AT and a shield that do -2 AT, when he buys a new weapon that give +1 At the case after 8 is a frame when he sees -2 and when he puts +1 and press OK the frame shows -1)
But the thing is, i have very little knowledge of programming, i did some C basic programs (like guess a number and stuff like that) and also some Basic long ago, but the thing is i never saw any piece of Java code and even if i did i don't think i understood it, but that's it, i still quite like to learn programming stuff but i think i wont make my players play on MapTools and this for 2 reasons : I cannot host a server, i'm using a phone that have a very limited acess bandwith and size limit, who shares by Wifi, and this since nearly 3 months, and i still dont know when thoose "Algerie Telecom" employees will move their arses and finally come to install the local phone and internet line but that's it it's Algeria and i dont have another choice even if that annoys me alot since i've always liked to play online games. And because of that i have to ask a freind to host the server for me but, he's not always here and avaiable for me, and he don't know a thing about how to use MapTools, the only thing he does is press the "Start Server" button, first i thought this was not going to be a problem, beacause i could upload the map, tokens and campaign proprieties separately so i asked for some of the players to join the server and i tried by putting what seems like a 10% done map, then the player told me "is it normal thoose red crosses ?"
And gave me a screen shot:
Spoiler
Image
The second reason is that, even if maptools is very complete it is limited and takes alot of time to build a map, i encountred alot of annoying things while building my map, i had a tavern and a shop on the same map, when i wanted to create a guard post, i put the floor big tile and the walls with no problem, then i put a desk and i wanted to make a sword appear under the desk , so i put a sword on the desk, i clicked once to send it to back and it disappeared completely under the floor then i clicked like 15 times on bring it to front, still didn't show so i deleted the sword, and that's just an example, i have this kind of problems always, another thing is, i don't know where is the paramater to make all the tokens on the map correctly "rotateable", i needed some tokens to make the NPCs in the inn, it worked fine with the innkeep and the first npc but when it came to the second it didn't want to rotate, only an arrow pointing the direction it was facing showed, and i tried to put other tokens but still the same problem.

So there is bugs, i can't download and search for good textures beacause of my limited subscription to internet (even if i could ask for someone to download a big pack if there was one), i can't host a server, it is very difficult to write macros and i can't find any "one for all" simple charachter sheet, i have problems doing maps and this takes time for a final view that is not THAT good.
But some of thoose problems can have solutions and maybe if i learn how to use it and fix thoose problems i will use again maptools but for the moment i told to my players that we're going to play on skype, less interface, less problems, less setup, but also no graphics and a bad gestion of the caracter sheets (both the player and me have a char sheet that we have to update at the same time)

PS : I'm sorry for this long post, but i think it's better to know my actual situation to understand me.
Attachments
test.cmpgn
(160.69 KiB) Downloaded 29 times

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Dont understand this no more

Post by aliasmask »

I have a question about your status bar. You pass it maxLen as 50. Does this represent the max number of columns of your bar? I imagine PV is the amount of the filled up bar and maxPV is relative to that value. So, if PV is 25 and maxPV is 100, then the bar is filled up 25% of the way. May I suggest you make maxLen a number based on pixels rather than columns since column size can vary. Although in your case it is the width of  .

Anyway, I've done some coding of my own and applied a couple of tricks to make your life easier when creating a character sheet template. First thing is you separate the code from the HTML. Here's an example:
||| CODE |||

Code: Select all

@@ @charSheet.template
<html>
<head>
   <link rel="stylesheet" type="text/css" href="%{styleSheet}">

   <title>Character Sheet (Big)</title>
</head>
<body>
<table style="text-align: left; width: 568px; height: 700px;">
  <tbody>
    <tr>
      <td style="width: 200px; height: 200px;"><img src="%{token.image}"></img></td>
      <td style="width: 350px; height: 200px;">
      <table style="width: 350px; height: 50px;">
        <tbody>
          <tr>
            <td style="height: 50px; width: 200px;">Nom :</td>
            <td style="height: 50px; width: 134px;">Sexe :</td>
          </tr>
        </tbody>
      </table>
      <table style="width: 350px; height: 54px;">
        <tbody>
          <tr>
            <td style="height: 50px; width: 119px;">Origine:</td>
            <td style="height: 50px; width: 215px;">Métier :</td>
          </tr>
        </tbody>
      </table>
      <table style="text-align: left; width: 350px; height: 85px;">
        <tbody>
          <tr>
            <td style="width: 100px; height: 78px;">%{statusBar}</td>
          </tr>
        </tbody>
      </table>
      </td>
    </tr>
  </tbody><tbody>
    <tr>
      <td style="width: 200px; height: 512px;"></td>
      <td style="width: 350px; height: 512px;">
         <table style="width: 350px; height: 262px;">
           <tbody>
             <tr>
               <td style="height: 50px; width: 200px;"></td>
               <td style="width: 65px;"></td>
               <td style="width: 63px;"></td>
             </tr>
             <tr>
               <td style="height: 50px; width: 200px;"></td>
               <td style="width: 65px;"></td>
               <td style="width: 63px;"></td>
             </tr>
             <tr>
               <td style="height: 50px; width: 200px;"></td>
               <td style="width: 65px;"></td>
               <td style="width: 63px;"></td>
             </tr>
             <tr>
               <td style="height: 50px; width: 200px;"></td>
               <td style="width: 65px;"></td>
               <td style="width: 63px;"></td>
             </tr>
             <tr>
               <td style="height: 50px; width: 200px;"></td>
               <td style="width: 65px;"></td>
               <td style="width: 63px;"></td>
             </tr>
           </tbody>
         </table>
         
         <table style="width: 350px; height: 257px;">
           <tbody>
             <tr>
               <td style="width: 119px; height: 250px; text-align: left;"></td>
             </tr>
           </tbody>
         </table>
      </td>
    </tr>
  </tbody>
</table>
</body>
</html>
}]

!!
@@ @charSheet
<!-- This function will print the character sheet -->

<!-- Get values needed for character sheet -->
[H: token.image = getTokenImage(200)]
[r: styleSheet = "CharSheet_css@"+getMacroLocation()]

<!-- get HP bar html -->
[h: hpBarArgs = json.set("{}",
   "maxLen",50,
   "value",PV,
   "maxValue",PVMax,
   "label",XP,
   "color","120,120,255"
)]   
[H: statusBar = ck.cs.statusBar(hpBarArgs)]

<!-- get character sheet html and put in values -->
[H: template = getMacroCommand(getMacroIndexes("charSheet.template"))]
[H: charSheet = strformat(template)]

<!-- Print character sheet frame -->
[frame("CharSheetBig"): {
   [R: charSheet]
}]

!!
 
Basically, all the html is put in to a macro and then read in to a variable as a string. The string is then processed with strformat to input values specified in a different macro, thus keeping them separate. All values that change in template are represented by %{varName} which is how strformat processes them. There are other methods like using [r: varname] or {varName} but sometimes your html may contain data that may look like code and then it blows up. ie Acid Arrow (creation) [acid] where acid now becomes a variable needing a value rather than simple text.

I also recommend lots of comments and some structure to the code. I wrote some coding tips here: http://forums.rptools.net/viewtopic.php ... 01#p236624

I'll post my changes once I play around with the hp bar. I've done a progress bar, which is similar to your hp bar but I put the value on one side and then switch once the other side was bigger. So, for example something like this:
example.jpg
example.jpg (4.14 KiB) Viewed 608 times
/// HTML \\\

Code: Select all

<table width=200>
   <tr>
      <td width="80" style="border-style:solid;border-width:1pt;background-color:lime;text-align:right;border-color:black;"> </td>
      <td style="border-style:solid;border-width:1pt;background-color:black;text-align:left;color:white;border-color:black;"> <b>40/100</b></td>
   </tr>
</table>
<table width=200>
   <tr>
      <td width="120" style="border-style:solid;border-width:1pt;background-color:lime;text-align:right;border-color:black;"><b>60/100</b> </td>
      <td style="border-style:solid;border-width:1pt;background-color:black;text-align:left;color:white;border-color:black;"> </td>
   </tr>
</table>
If not this, what kind of style are you going for?

User avatar
Chkoupi
Kobold
Posts: 9
Joined: Wed Jul 08, 2015 5:13 pm
Location: Tlemcen, Algeria
Contact:

Re: Dont understand this no more

Post by Chkoupi »

Actually, i don't know what's possible to do, the bar wich is actually in the campaign (that i copied from the wiki) was really fancy.
But i think your method is better as it is much more simple, i don't need for the "40/100" or "60/100" to be shown inside the status bar, actually i dont need it to be shown at all because the variables that it will represent will be somewhere else in the CharSheet i have an idea for a status bar if you could explain to me if there is any error
Spoiler

Code: Select all

@@ @CharSheet
<!-- get HP bar html -->
[h: Percent = PV/PVMax*100]
[h: StatusBarArgs = json.set("{}",
   "Percent",Percent,
   "Color","{r},{g},{b}"
)]   

@@ @StatusBar
[h: Color=getStrProp(macro.args, "Color")]
[h: Percent=getStrProp(macro.args, "Percent")]
[h: r=listGet(Color,0)]
[h: g=listGet(Color,1)]
[h: b=listGet(Color,2)]
<table width=200>
   <tr>
      <td width="Percent*2" style="background-color: rgb({r},{g},{b})"> </td>
      <td style="background-color:white"></td>
   </tr>
</table>

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Dont understand this no more

Post by aliasmask »

Something very odd is going on with the parser.

I'm getting an error on this line:

Code: Select all

[H, if(percent == 0): barHtml = '<table width=200><tr><td style="background-color:white"> </td></tr></table>']
Apparently it doesn't like ' ' in the string. I'm going to experiment and see why.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Dont understand this no more

Post by aliasmask »

So, apparently it was a really obscure parser bug that no one has found/figured out. Anyway, here's your campaign file with it working.
Attachments
test-am.cmpgn
(205.1 KiB) Downloaded 29 times

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Dont understand this no more

Post by Jagged »

Something to look at when Craig adds the parser project to GitHub.

Post Reply

Return to “Macros”