Problem with Variable - Macro

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: Azhrei, dorpond, trevor

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
Darelius
Cave Troll
Posts: 32
Joined: Thu Aug 19, 2010 1:04 pm

Problem with Variable - Macro

Post by Darelius »

Hello, its me - again :(

So, this time i have a "Problem":
I want to create a macro, which gives back a table to fill in.
Normally no problem, but with this one i have some...

The table should have graphics (from the "table") and macros.

Code: Select all

[h: Alt="<tr>
<td>
<a href='[r: macroLinkText('[email protected]:Character','','',getSelected())]'>
<img src='[r: tblImage('SystemGrafiken',1)]'>
</img></a>
</td>
"]
<table>
[r: Alt]
<tr><td>test</td></tr>
<td>
<a href='[r: macroLinkText('[email protected]:Character','','',getSelected())]'>
<img src='[r: tblImage('SystemGrafiken',1)]'>
</img></a>
</td>
</table>
I tried many "format tries" with ' and " but nothing works.
This line works, when used directly in the table.
But how i can put it in a variable and keep it working?
After several tries (and hours) i ask here for help ;)
(by the way, i put it in a "frame5" formular, maybe that makes it more difficult, instead of the "chat")


...DX

User avatar
wolph42
Deity
Posts: 9703
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Problem with Variable - Macro

Post by wolph42 »

the first thing I notice is that you use ' ' both in and outside the macro [] blocks, thats a good reason for things to fail.
Next I would suggest that you read the 'READ THIS' link in my sig and get familiar with the MT macro syntax cause I see you using

[h: ..... [r: .... ] .....] and that is NOT possible (unless you use code blocks which you don't ).

review your code and try again, it might fail again but we'll be there to help!

Darelius
Cave Troll
Posts: 32
Joined: Thu Aug 19, 2010 1:04 pm

Re: Problem with Variable - Macro

Post by Darelius »

As i wrote before, i tried MANY forms with the " and ' and nothing worked so far.
So i posted the working, original Link, that work on direct use, not in the variable

Even if i try to make all " inside as ' and only outside " have no change.
Also a combination or 'code'+var+'code' i tried (in normal circumstances it work!), but not within the macro link system, thats, why i ask here for help.

Again, i want to put this think

Code: Select all

<td>
<a href='[r: macroLinkText('[email protected]:Character','','',getSelected())]'>
<img src='[r: tblImage('SystemGrafiken',1)]'>
</img></a>
</td>
(working alone with no problems)
in a variable to give as return from a macro

Makro 1 is calling macro 2, which create that string and return it to macro 1 wich will make an output with it by simple [r: var].
Another Table (without internal macro llinks) i used the same way, worked but with the macro intern no function - even the "image" didnt work either.
(yes i used other ' and " formats..

So anyone can help me get this working?


...DX

User avatar
aliasmask
Deity
Posts: 8578
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Problem with Variable - Macro

Post by aliasmask »

You never mentioned what the error was, but I notice some improperly formatted html. This is what I came up with. I also added "all" to output of macro link assuming when you click link it will generate output. Otherwise, you can put "none".

Code: Select all

[H: link = macroLinkText('[email protected]:Character','all','',getSelected())]
[H: imageId = tblImage('SystemGrafiken',1)]

[H: output = strformat('
<table>
   <tr>
      <td><a href="%{link}"><img src="%{imageId}" /></a></td>
   </tr>
   <tr><td>test</td></tr>
   <tr>
      <td><a href="%{link}"><img src="%{imageId}" /></a></td>
   </tr>
</table>
')]

[R: output]

Darelius
Cave Troll
Posts: 32
Joined: Thu Aug 19, 2010 1:04 pm

Re: Problem with Variable - Macro

Post by Darelius »

You saved me!!

Thats awesome ;)

I will remove the "all", because the output is just the "frame5" thats opend and that works fine so far ;)

I will tet it immediatly ;)
.
.
*testing*
.
.
.
Works perfect!
Thank you very much!

(never have seen that "href="%{link}" - so far but who cares - it works!)

Tanks again!


...DX

Post Reply

Return to “MapTool”