RPTools.net

Discussion and Support

Skip to content

It is currently Mon Nov 20, 2017 2:45 am 






Reply to topic  [ 5 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Fri Apr 05, 2013 7:36 am
Posts: 10
 Post subject: Weapon Exchange and Attacking
PostPosted: Tue Sep 09, 2014 5:47 pm 
If I submitted in the wrong area sorry...

Okay so I was trying to make a macro that would work with three other macros. The three macros are when I'd be wielding a light mace, a longsword, and a javelin. The latter of the three on a near identical only using Dexmod for attack instead of Strmod.

I was wondering if there was a better way to do this, or a way to make this all into one macro so I could select between the two melee weapons in a window, that would modify the 1d4 to a 1d8, and add the +1 to attack for the longsword. After that I could make a duplicate and edit to make a ranged version with a second one.

With the way that I made the macro I couldn't make a critical confirm macro at the end, though considering the longsword has a different crit that would probably be too much trouble then what it's worth.

This was my attempt, so that maybe I could explain things a bit better with it, I also didn't want to just ask without trying myself for an hour or two....

Side note: Misc2-5 are there for expansion

Code 1:

Code:
[h:A2=Ability2]
[h,if(A2 >= 1),code:
{
    [if(A2 == 1),code:
{
    [h:damage=1d8]
};
{
[h:damage=1d4]
}]
};
]
<table border="0">
  <tr bgcolor="#CC0000">
    <table width="100%">
      <tr>
        <td style="padding:0px 5px;">
          <span style="color:white"><b>Stike True {Ability1}!</b></font>
          <span style="color:Green"> <br>Zanward has a +[t:Attack1Bonus=Bab+Strmod+Misc1+Misc2+Misc3] to Attack</font>
        </td>
      </tr>
    </table>
  </tr>
  <tr>
    <td>
      Zanward Greyhunt swings his {Ability1} ([t:roll=1d20]+ [t:Attack1Bonus] = {results=roll+Attack1bonus}) and does ([t:damage+strmod+Misc4+Misc5]) damage!

   </td>
  </tr>
</table>


Code 2,3,4 (Pretty Much):

Code:
[t:Ability1="Hammer, light"]
[h:Misc1=0]
[h:Ability2=2]


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Weapon Exchange and Attacking
PostPosted: Wed Sep 10, 2014 2:00 am 
its too vague for me what you actually want to achieve.

You have three weapons and they all three have small differences. can you point out in a table what those differences are and what the ranges of values are... e.g. this:

Code:
[h,if(A2 >= 1),code:{
    [if(A2 == 1),code:{
        [h:damage=1d8]
    };{
        [h:damage=1d4]
    }]
}]
 
looks rather convoluted, what happens if A2 < 0 ? is that possible in your case (your code will break then btw).
If you use e.g. this:
Code:
[h,if(A2 == 1),code:{
    [damage=1d8]
};{
    damage=1d4]
}]
 

then at least your code can't break, which you can write as
Code:
[h,if(A2 == 1):    damage=1d8 ; damage=1d4] 

or even faster:
Code:
[h: damage    = if(A2 == 1, 1d8, 1d4)] 

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Kobold
 
Joined: Fri Apr 05, 2013 7:36 am
Posts: 10
 Post subject: Re: Weapon Exchange and Attacking
PostPosted: Wed Sep 10, 2014 8:14 pm 
Honestly, no the code will never be 0 since longsword adds 1, hammer is 2, and javelin is 3. One and two, and two and three are separated as pairs since one uses dexmod, rather then str mod to damage.

But thank you for tips of how to condense it, it'll make it look better, and not be one giant mess.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9419
Location: Netherlands
 Post subject: Re: Weapon Exchange and Attacking
PostPosted: Thu Sep 11, 2014 2:27 am 
well since you failed to give the table, I just made some stuff up. This is roughly where you should be heading to, both in structure of code (input, calc, output) as in fast execution. You can add the html flavour ofcourse and since that is all 'string' you can just add that to the txtOutPut variable.

Code:
<!-- INPUT -->
[
h:tok    getSelectedNames()]
[
h:assert(listCount(tok)==1,"Please select (only) one token first",0)]
[
h:switchToken(tok)]
[
h:input("weapon|Longsword,Hammer,Javelin|Choose weapon|RADIO|VALUE=STRING SELECT=1")]

<!-- 
CALCULATIONS -->
[
h,switch(weapon),code:
case 
"Longsword": {
    [
damage        1d8]
    [
addDamage    dexMod]
};
case 
"Hammer": {
    [
damage        1d4]
    [
addDamage    dexMod]
};
case 
"Javelin": {
    [
damage        1d8]
    [
addDamage    strMod]
};
default: {
    [
assert(0,strformat("You chose %{weapon}, which is not a valid choice"),0)]
}]
[
h:totalDamage    damage addDamage misc]

<!-- 
OUTPUT -->
[
h:txtOutPut    strformat("%{tok} strikes with his/her %{weapon} and does %{totalDamage} (roll=%{damage}, mod=%{addDamage}, misc=%{misc}).")]

[
r:txtOutPut]
<!-- OR -->
[
h:broadcast(txtOutPut)]
 


UNTESTED!!

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Kobold
 
Joined: Fri Oct 24, 2014 9:59 pm
Posts: 1
 Post subject: Re: Weapon Exchange and Attacking
PostPosted: Fri Oct 24, 2014 10:10 pm 
Please Identify the range and the proper codes to re-code it and by the way can you put some print screen about the weapons form?

_________________
united cutlery throwing knives


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 5 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman