Function to make prettier forms

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

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

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: Function to make prettier forms

Post by Nildik »

This is for you wolph42, in gratitude for all your work with maptool.
Attachments
frames3.mttable
(3.86 MiB) Downloaded 131 times
examples.jpg
examples.jpg (71.56 KiB) Viewed 5779 times


User avatar
Oryan77
Dragon
Posts: 452
Joined: Sun Feb 20, 2011 3:14 pm

Re: Function to make prettier forms

Post by Oryan77 »

Now this is the sort of eyecandy that Maptool needs to spice up the interface! Your frames are very nice looking to. I like your style.

If you are in the mood to make some more, I'd like to see some sort of industrial (grungy/grimy/rusted metal) looking frames. Maybe even some that look like stone or rock to give a "dungeon" feel. :D

*edit* I loaded the lib and table files and ran the oncampaignload macro, but I get the message:

Code: Select all

« defineFunction( "frameOpen", "frameOpen@lib:frames",0) = Invalid expression: defineFunction( "frameOpen", "frameOpen@lib:frames",0) . » « defineFunction( "frameClose", "frameClose@lib:frames",0) = Invalid expression: defineFunction( "frameClose", "frameClose@lib:frames",0) . »
I'm not good at writing macros, so I'm not sure what this means or if I'm doing something wrong.

Nildik
Cave Troll
Posts: 76
Joined: Mon Oct 31, 2011 7:32 pm

Re: Function to make prettier forms

Post by Nildik »

Oryan77 wrote:If you are in the mood to make some more, I'd like to see some sort of industrial (grungy/grimy/rusted metal) looking frames. Maybe even some that look like stone or rock to give a "dungeon" feel.
If you have some images or textures in the style you want for the new frames, sends it to me, this is very useful for me at the time to "design" the frame.
Oryan77 wrote:I'm not good at writing macros, so I'm not sure what this means or if I'm doing something wrong.
You are doing all well, this is an old malfunction of the macro onCampaignLoad. This happens to me as well, and i dont know why.
The function onCampaignLoad runs automatically when you start a campaign. Load the lib, and the table, save the campaign, close it and reopen it. Try to use the function, probabily works now. If not, maybe somebody of the more experimented users could help you.

Sorry for my english, I'm not anglophone and i'm sure that there are a lot of grammar errors in my text.

User avatar
Oryan77
Dragon
Posts: 452
Joined: Sun Feb 20, 2011 3:14 pm

Re: Function to make prettier forms

Post by Oryan77 »

Nildik wrote:If you have some images or textures in the style you want for the new frames, sends it to me, this is very useful for me at the time to "design" the frame.
I was thinking like a frame that appears chipped or cracked, but still have a fancy border (with designs) similar to what you already created. It would just look like an old and damaged frame.

I thought a stone type of texture and a scratched & rusted metal texture similar to these textures would look good:
http://www.hybridlava.com/free-stuff/75 ... ckgrounds/

And not to pimp my own website, but it has a similar style to what I'm trying to describe to you:
www.rpglocker.com
Nildik wrote:You are doing all well, this is an old malfunction of the macro onCampaignLoad. This happens to me as well, and i dont know why.
The function onCampaignLoad runs automatically when you start a campaign. Load the lib, and the table, save the campaign, close it and reopen it. Try to use the function, probabily works now. If not, maybe somebody of the more experimented users could help you.

Sorry for my english, I'm not anglophone and i'm sure that there are a lot of grammar errors in my text.
That worked. Thanks, and don't worry about your english. It is much better than I would do if I tried to speak your native language. You have nothing to worry about. :P

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Function to make prettier forms

Post by wolph42 »

@Nildik. I've started using your drop-in and I immediately missed an overview function, so I created one:

Code: Select all

[frame ("Show Case"):{
        <html>
            <table><tr><td>
                [count(13), CODE:{
                    [R: frameOpen(roll.count,"Frame Title "+roll.count,"WHITE")]
                        <font color=white>this is text in frame [r:roll.count]<br></font>
                        <font color=black>this is text in frame [r:roll.count]<br></font>
                    [R: frameClose(roll.count)]
                    [h:counter = (roll.count+1)/3]
                    [r:if(floor(counter)==counter, "</td></tr><tr><td>","</td><td>")]
                }]
            </td></tr></table>
        </html>
}]
 
Maybe you want to add this to your drop-in.
Also I noticed that you uploaded a newer version some posts up. Its customary here to update the original post with the latest versions. So you might want to do that.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Function to make prettier forms

Post by wolph42 »

and you had a bug in both open/close frame macros, here another update (also rewrote a bit so its faster):

Code: Select all

[h:'<!-- --------------------------------------------- frameOpen by Nildik ----------------------------------------------------- -->']

[h:numArgs    = argCount()]
[h,if(numArgs>0):    ind        = arg(0)    ; ind        = 1] 
[h, if(numArgs>1):    titulo    = arg(1)    ; titulo    = ""] 
[h, if(numArgs>2):    color    = arg(2)    ; color        = "black"]
[h,count(5):        set(  "fondo"+roll.count , tableImage("frames",ind * 10 + roll.count + 1)  )]

[h:output    = "
    <table border='0'  cellspacing='0' cellpadding='0'  width='100%'  align='center'>
        <tr>
            <td " + table("frames", ind*10+1) + " background=" + fondo0 + " style='font-size:1px'>
            </td>
            <td  background = "+fondo1+" style='font-size:1px'>
            "+ if(titulo=="" , "</td>", "<h3 align=center><font color=" + color + ">" + titulo + "</font></H3></td>") +"
            <td  "+table("frames", ind*10+3)+" background=" + fondo2 + " style='font-size:1px'>
            </td>
        </tr>
        <tr>
            <td background=" + fondo3 + " style='font-size:1px'>
            </td>
            <td background=" + fondo4 + ">
"]

[r:output]


[h:'<!-- --------------------------------------------- frameClose by Nildik ----------------------------------------------------- -->']
[h: numArgs    = argCount()]
[h, if(numArgs>0):    ind    = arg(0)    ; ind    = 1]
[h, count(4):        set(  "fondo"+(roll.count + 5) , tableImage("frames",ind * 10 + roll.count + 6)  )]

[h:output    = "
            </td>
            <td style='background-image: url(" + fondo5 + "); background-repeat: repeat; font-size:1px'>
            </td>
        </tr>
        <tr>
            <td " + table("frames", ind*10+7) + " background=" + fondo6 + " style='font-size:1px'>
            </td>
            <td  background=" + fondo7 + if(ind==0," style='padding-bottom: 10px; font-size:1px''>
                <input type='text' size=30>
            </td>", " style='font-size:1px'></td>") + "
            <td background=" + fondo8 + " style='font-size:1px'>
            </td>
        </tr>
    </table>
"]

[r:output] 

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Function to make prettier forms

Post by Full Bleed »

Nice work Nildik!

I certainly plan on using this. My framework is functional, but also pretty ugly.

As Wolph mentioned, it's customary around here to always have the most updated version of your mod in the top post so people don't have to search throughout a thread to get the latest. Speaking for myself, I'm going to wait to see if you incorporate Wolph's additions/fixes before I start using it in earnest.


Thanks for the extra frames, too. Good stuff.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Function to make prettier forms

Post by wolph42 »

Full Bleed wrote:Nice work Nildik!

I certainly plan on using this. My framework is functional, but also pretty ugly.

As Wolph mentioned, it's customary around here to always have the most updated version of your mod in the top post so people don't have to search throughout a thread to get the latest. Speaking for myself, I'm going to wait to see if you incorporate Wolph's additions/fixes before I start using it in earnest.


Thanks for the extra frames, too. Good stuff.
Here you go:
libframes-W42-update.rptok
(14.54 KiB) Downloaded 123 times
I've also moved the lot onto a new token as I kept keeping the 'undefined function error' OCL. I've tested this one and it seems to work.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Function to make prettier forms

Post by Full Bleed »

wolph42 wrote:Here you go:
Thanks.

Can you show some sample code of this in action? I was converting a dialog to a frame and I'm obviously not using this as intended.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Function to make prettier forms

Post by Full Bleed »

Can someone show some sample code of this thing in action?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: Function to make prettier forms

Post by mfrizzell »

This is just the start of a conversion but it displays properly with all of my variables and properties.

Code: Select all

[h: tokenDudeID = macro.args]
[h:myGear = mlf.Gear]
[h:myGearList = json.fields(myGear)]
[h:gearTblSection=""]
[h,foreach(gearItem, myGearList),CODE:
{
  [det = json.get(myGear, gearItem)]
  [gearTblSection = strformat("%s%dx %s<br>", gearTblSection, json.get(det,"qty"), gearItem)]
}]
<body bgcolor='white'>



[frame("Character Sheet"):
{
  <html>
  [R: frameOpen(2,"Character Sheet","WHITE")]
  
  <table border=0 width='100%'>
 <tr> 
[r:MacroLink("Main", "Main@Lib:AD&D", "none", "",tokenDudeID)]
[r:MacroLink("Spells", "Spells@Lib:AD&D", "none", "",tokenDudeID)]
[r:MacroLink("Gear", "Gear@Lib:AD&D", "none", "",tokenDudeID)]
</tr>
<tr>
<td colspan='4' align="center" ><img src='[r:getTokenImage()]'></img></td>
</tr>

  <tr bgcolor='#000000' color='white'>
  <td colspan='2'><b>[r:getName()]</b></td>
  <td colspan='2'><b>Level [R:mlf.Level] [r:mlf.Race] [r:mlf.Class]</b></td>
  </tr>
<tr bgcolor='#cccccc'>
<td  colspan='2'><b>Alignment</b>: [r:mlf.Alignment]</td>

  </tr>
  <tr bgcolor='#eeeeee'>
  <td><b>[r:MacroLink("HP/MaxHP:", "mlf.HPAdjust@Lib:AD&D", "all", "",tokenDudeID)]</b> [r:mlf.HP] / [r:mlf.HPMAX]</td>
  <td><b>[r:MacroLink("XP:", "mlf.XPAdjust@Lib:AD&D", "all", "",tokenDudeID)]</b> [r:mlf.XP]</td>
  <td><b>[r:MacroLink("AC:", "mlf.ACAdjust@Lib:AD&D", "all", "",tokenDudeID)]</b> [r:mlf.ArmorClass]</td>
  <td><b>[r:MacroLink("Level:", "mlf.LevelAdjust@Lib:AD&D", "all", tokenDudeID,tokenDudeID)]</b> [r:mlf.Level]</td>
  </tr>
<tr bgcolor='#cccccc'>
<td><b>[r:MacroLink("STR", "mlf.STRCheck@Lib:AD&D", "all", "",tokenDudeID)]</b>:[r:mlf.Strength]</td>
<td><b>[r:MacroLink("CON", "mlf.CONCheck@Lib:AD&D", "all", "",tokenDudeID)]</b>:[r:mlf.Constitution]</td>
<td><b>[r:MacroLink("DEX", "mlf.DEXCheck@Lib:AD&D", "all", "",tokenDudeID)]</b>:[r:mlf.Dexterity]</td>
<td>[MacroLink("edit","mlf.editCharacter@Lib:AD&D", "", tokenDudeID,tokenDudeID)]</td>
  </tr>
<tr bgcolor='#eeeeee'>
<td><b>[r:MacroLink("INT", "mlf.INTCheck@Lib:AD&D", "all", "",tokenDudeID)]</b>:[r:mlf.Intelligence]</td>
<td><b>[r:MacroLink("CHA", "mlf.CHACheck@Lib:AD&D", "all", "",tokenDudeID)]</b>:[r:mlf.Charisma]</td>
<td><b>[r:MacroLink("WIS", "mlf.WISCheck@Lib:AD&D", "all", "",tokenDudeID)]</b>:[r:mlf.Wisdom]</td>
  </tr>

  <tr bgcolor='#cccccc'>
   <td><b>THACO</b>: [r:mlf.THAC0]</td>

  </tr>
  <tr bgcolor='#eeeeee'>
  <td valign='top' colspan='4'>
  <b>Spell Book</b>: <br>
  [h:SpellList = json.fields(mlf.SpellBook,"json" )]
  [r:  json.toList(SpellList)]

  </td>
</tr>
  <tr bgcolor='#cccccc'>
  <td valign='top' colspan='4'>
  <b>Memorised</b>:<br>
  [h:SpellMem = json.fields(mlf.SpellsMemorised,"json" )]
  [r:  json.toList(SpellMem)]
</td>  
</tr>
  <tr>
  <td valign='top' colspan='2'>
  <b>Armor</b>: 
  [r:mlf.EquipedArmor]
  [r:if(mlf.EquippedShield==1," & Shield","")]
  </td>
  <td valign='top' colspan='2'>
  <b>Weapons M / R</b>: 
  [r: json.get(EquipedWeapon,"ItemName")] /  [r:mlf.EquippedRanged]
  </td>
</tr>
<tr>
<td valign='top' colspan='4' bgcolor='#dcdcdc'><b>Additional Gear</b></td>
</tr>
<tr>
<td colspan='4' bgcolor='#dcdcdc'>
[r:gearTblSection]
</td>
</tr>
</table>
</body>
[R: frameClose(2)]
</html>
}]
Hope it helps
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."


User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Function to make prettier forms

Post by Full Bleed »

Those examples helped a lot. Thanks.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Oryan77
Dragon
Posts: 452
Joined: Sun Feb 20, 2011 3:14 pm

Re: Function to make prettier forms

Post by Oryan77 »

Can someone help me properly setup a macro for using these frames?

I'm trying to set up an example gallery of these frames similar to how Wolph42 has a "Show Case" window displaying via his "frameOverview" macro located on the latest .rptok file he uploaded here.

I'm not sure how he did that, so I was trying to do it the way the original "Example" macro is done in this same token. The reason I did not simply use his macro is because I preferred to have them displayed differently with different text. Here is the code I wrote:
Spoiler

Code: Select all

[frame ("Show Case"): {
	<html>

	[R: frameOpen(1,"EXAMPLES OF FRAMES (this is the frame number 1)","WHITE")]
<font color=white>Use of function frames: You can enclose everything in a form into a nice frame like this. Write: frameOpen(number).... your form.... frameClose(same number)<br><br>
<table><tr>
<td width=25%>
[R: frameOpen(0,"Example","white")]
(frame 0)<br><br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(0)]

</td><td width=25%>
[R: frameOpen(1)]
(frame 1)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(1)].

</td><td width=25%>
[R: frameOpen(2)]
(frame 2)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(2)].

</td><td width=25%>
[R: frameOpen(3)]
(frame 3)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(3)].

</td><td width=25%>
[R: frameOpen(4)]
(frame 4)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(4)]

</td><td width=25%>
[R: frameOpen(5)]
(frame 5)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(5)]

<p>

</td><td width=25%>
[R: frameOpen(6)]
(frame 6)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(6)]

</td><td width=25%>
[R: frameOpen(7)]
(frame 7)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(7)]

</td><td width=25%>
[R: frameOpen(8)]
(frame 8)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(8)]

</td><td width=25%>
[R: frameOpen(10)]
(frame 10)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(10)]

</td><td width=25%>
[R: frameOpen(11)]
(frame 11)
<H2>Example</H2>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
TEXT<br>
[R: frameClose(11)]

</td></tr></table>
	
	[R: frameClose(1)]

	</html>
}]
I can't figure out how to space the frames apart in a nice layout and so that none of the sides get cut off. I also can't figure out how to display some of the frames below others so the window is not so long horizontally. Here is what I end up with:
Spoiler
frames.jpg
frames.jpg (151.5 KiB) Viewed 5417 times

Post Reply

Return to “Drop-In Macro Resources”