Can someone combine two macros for me?

Talk about whatever topic you'd like, RPG related or not. (But please discuss things related to our software in the Tools section, below.)

Moderators: dorpond, trevor, Azhrei

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

Re: Can someone combine two macros for me?

Post by wolph42 »

well had a look at the second one too (what a bloody mess) and it looks like its only partial code, I've shovelled the lot around to a more logical structure and kicked out double variables, but the html stops in the middle so it appears to be unfinished (or REALLY badly coded):

Code: Select all

[h:WeatherList    = "Great Light,Good Light,Adverage Light,Bad Light,Dim Light,No Light,Light Rain,Medium Rain,Heavy Rain,Storm,Blizzard"]
[h:Lselect        = listFind(WeatherList, Lmod)]
[h:Vrange        = (Prange+Per)*3]

[H: visTokens    = "[]" ]
[H: visTokenIDs    = getVisibleTokens("json") ]
[H, FOREACH( i, vistokenIDs ): visTokens = json.append( visTokens, json.set( "{}", "name", getName(i), "id", i, "range", getDistance(i) ) ) ]
[H: visTokens    = json.sort( visTokens, "ascend", "range", "name" ) ]
[H: visTokenNames    = "[]" ]
[H, FOREACH( i, visTokens ), CODE: {
   [ visTokenRange = json.get( i, "range" ) ]
   [ visTokenNames = json.append( visTokenNames, "(" + if( visTokenRange <= Vrange, "<font color=red>", "" ) + visTokenRange + " hexes" + if( visTokenRange <= Vrange, "</font>", "" ) + ") " + json.get( i, "name" ) ) ]
}]

[H: visTokenNameList = "Not Specified" ]
[H, FOREACH( i, visTokenNames, "" ): visTokenNameList = listAppend(visTokenNameList, "<html>" + replace( i, ",", "_" ) +  "</html>" ) ]

[H: abort(input(
    "tTarget1 | " + visTokenNameList + " |Target|LIST|",
    "hitbonus|0|To Hit Mod",
    "CoverMod|0|Cover Mod",
    "TargetMod|Torso,Legs,Arms,Groin,Head,Eyes|Aimed Shot|LIST|SELECT=0",
    "LMod|Great Light,Good Light,Adverage Light,Bad Light,Dim Light,No Light,Light Rain,Medium Rain,Heavy Rain,Storm,Blizzard|Lighting/Weather|LIST|SELECT="+Lselect+" VALUE=STRING",
    "Threshold|0|Damage Threshold",
    "Resistance|0|Damage Resistance"
))]

[H,if( tTarget1 == 0 ): target1ID = ""; target1ID = json.get( json.get( visTokens, tTarget1-1 ), "id" ) ]
[H,if( tTarget1 == 0 ): target1Name = ""; target1Name = json.get( json.get( visTokens, tTarget1-1 ), "name" ) ]

[H: targString     = if( target1Name     == "", "", "<b>Target: </b>" + target1Name )    +    if( target1Name     == "", "", "<br>" ) ]
[h:TargetAC    = getProperty("AC",target1ID)]
[h:Distance    = getDistance(target1ID)]

[h:Skill    = Pskill]
[H:Rangemod    = (3*(Distance-(PER+PRange)))]
[H:Ra        = if(Rangemod<0,"0",Rangemod)]
[h:L        = listGet("0,10,20,50,80,200,30,40,60,80", listFind(WeatherList, Lmod))]
[h:S        = listGet("0,10,15,15,20,30", TargetMod)]
[h:ACC        = listGet("0,20,10,20,25,30", TargetMod)]
[h:DMG        = Eval(PammoDMG + "+" + PDamage)]

<table border="0">
    <tr bgcolor="#000000">
        <table width="100%">
            <tr>
                <td style="padding:0px 5px;">
                    <span style="color:#33FF00">
                        <b>{targString}
                    </span>
                </td>
            </tr>
        </table>
    </tr>
    <tr>
        <td>
            <table border="0">
                <tr bgcolor="#000000">
                    <table width="100%">
                        <tr>
                            <td style="padding:0px 5px;">
                                <span style="color:#33FF00">
                                    <b>{PrimaryWeapon}</b>
                                </span>
                            </td>

                            <td style="padding:0px 5px;" align=right>
                                <span style="color:#33FF00">
                                    {Skill}:{Base=Eval(Skill)}
                                </span>
                            </td>
                        </tr>
                    </table>
                </tr>
                <tr>
                    <td>
                        <b>Distance: </b>[t:Distance] Hexes<br>
                        <b>Hit Chance: </b>[T:tohit=Base-Ra-L-TargetAC-CoverMod-S+hitbonus]<br>
                        <b>Attack Roll:  [t:Roll=1d100] [t:if(Roll<=tohit,", Hit",", Miss - 1 To Weapon Condition")]<b>[t:if(Roll<=(CC+ACC),", Critical!","")]</b><br>
                        <b>Damage; </b>[t:Round((Dmg-Threshold)-((DMG-Threshold)*(Resistance*0.01)))]<br>
                        <small><i>Remaining Ammo:[t:PRounds=PRounds-1]
                        [t:Ammocheck= if(Prounds<=0,"Out of Ammo!","")]
<!-- and here the code suddenly stops....??  -->
 

meshon
Cave Troll
Posts: 75
Joined: Fri Mar 26, 2010 10:54 am
Location: AB, Canada

Re: Can someone combine two macros for me?

Post by meshon »

wolph42 wrote:tip: if you see something fancy in someone's post and want to know how they did it: click the 'quote' button of the post and you can check it out.
Ah yes, thank you quite a lot!

cheers,
Meshon

Underableedingsun
Kobold
Posts: 16
Joined: Fri Mar 02, 2012 4:20 am

Re: Can someone combine two macros for me?

Post by Underableedingsun »

Alright, sorry for the delayed response, been very busy the last day or so.

So, apparently this is some poorly done coding and doesn't seem to work with everything. Let me try and address all the questions and not miss anything.

1) I should have mentioned only the pip boy icon is programmed where the attack macro works, though the damage macro was working on every token.

Aliasmask: Yes that was pretty much what I was trying to get. I had seen it in the PF framework and was trying to get it to work in my game.

Wolph42: The new rewritten macro works, but it always says character is staggered, even if still conscious. The below negative hp's and death part works fine though. The one thing I don't like about it is I have to impersonate the token. As the GM that creates an extra step that makes larger battles harder to difficult. Of course, if that work'd with the attack macro it wouldn't really matter as that removes a few steps.

I think that was everything. Sorry I'm such a noob with coding.

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

Re: Can someone combine two macros for me?

Post by wolph42 »

Staggered: that's because that's how te macro is constructed. You can remove that line from the code and then it will only check the HP<0
Impersonated: check the 'apply to selected token' in the macro edit panel.

edit: staggered revisited: just realised that its my bad, I misinterpreted the code that line(s) should look like this:

Code: Select all

[h,if(HP < 0):
    txtOutput = txtOutput + if(HP > (-1*Endurance), token.name + " is unconscious!", token.name + " is dead!")
;
    txtOutput = if(!HP, txtOutput + token.name + " is staggered!", txtOutput )
] 
'!' means NOT (TRUE) and NOT TRUE is always equal to 0, where TRUE is everything else. So now it says 'IF HP = 0 THEN staggered ELSE no change

Post Reply

Return to “General Discussion”