RPTools.net

Discussion and Support

Skip to content

It is currently Sun Oct 22, 2017 2:17 pm 






Reply to topic  [ 24 posts ]  Go to page Previous  1, 2

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Dragon
 
Joined: Wed Aug 31, 2011 8:49 pm
Posts: 495
Location: Somewhere between Heaven and Hell
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Wed Aug 16, 2017 4:09 pm 
I have no clue about the error you're getting, sorry Dorpond =/ I'm not by any means 'pro' like these guys at clean and simple scripts, but I saw your question and had just recently coded that into my 5E framework so thought I'd drop in the same lines I used for my prototype. I usually try to just get it working, then spend weeks cleaning it up with little snippits of code samples I see these guys posting all over the forums XD

I did test this in 1.4.1.7 and it seemed to function just peachy. Hope you get it worked out - with these guys helping, I'm sure you will =)

_________________
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

Image


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Thu Aug 17, 2017 9:05 am 
Xaelvaen wrote:
I did test this in 1.4.1.7 and it seemed to function just peachy. Hope you get it worked out - with these guys helping, I'm sure you will =)


I appreciate your help - thank you!

I think your code is a result of coping and pasting from the forums (or something like that), so could you please upload your code in a txt file? I would really like to see how yours works. Thanks!

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Thu Aug 17, 2017 9:11 am 
SOLUTION: with the help of many up here, we were able to get this working. The solution depends on Bag of Tricks for it to work properly. Thank you guys!

I attached the code below.

I would also love to get Xaelvaen's version working also, which doesn't depend on BoT, if for any reason, just to learn and understand more.

Xaelvaen, could you put your code into a txt file like Aliasmask did, to see if it is the copy paste issue from the forum? Much appreciated!

Code:
<!-- set some basic values -->
[H: saveDC = 0]
[H: tokenList = getSelected()]
[H: statNameList = "STR,DEX,CON,INT,WIS,CHR"]
[H: advantageColorCode = "black,blue,red"]
[H: output = ""]

<!-- get user input -->
[H: abort(input("saveDC|0|Enter Save DC|TEXT",
    "rollAdvantage|No Advantage,Advantage,Disadvantage|Select Advantage|RADIO|ORIENT=H",
    strformat("statName|%{statNameList}|Choose Stat Save|RADIO|VALUE=STRING"),
    "outputType|all,self,gm|Output to Who?|RADIO|SELECT=1 ORIENT=H VALUE=STRING"
))]

<!-- get token data, rolls and saving throw modifier -->
[H, foreach(tokenId,tokenList), code: {
    [H: switchToken(tokenId)]
   
    <!-- get advantage roll -->
    [H: saveRoll = 1d20]
    [H, if(rollAdvantage == 1): saveRoll = max(1d20,saveRoll)]
    [H, if(rollAdvantage == 2): saveRoll = min(1d20,saveRoll)]
   
    <!-- get token stat save roll modifier. note: token name is not case sensitive -->
    [H: statModifier = getProperty(statName+"Save")]
   
    <!-- calc total -->
    [H: rollTotal = statModifier + saveRoll]
    [H: rollColor = listGet(advantageColorCode,rollAdvantage)]
   
    <!-- set state DCFail value. Probably shouldnt do it here, but its easier -->
    [H, if(rollTotal < saveDC): state.DCFail = 1; state.DCFail = 0]
   
    <!-- save output for each token -->
    [H: output = json.append(output,strformat('%{token.name} makes a %{statName} Save and gets a <span title="Roll: %{saveRoll}; Mod: %{statModifier}"><b color="%{rollColor}">%{rollTotal}</b></span>.'))]
}]

<!-- Display Output -->
[H: broadcast(json.toList(output,"<BR>"),eval("bot_"+outputType+"()"))]

<!-- you can remove this line if you make a function of this with hidden output, or you can remove all the comments for final macro -->
[H: abort(0)]

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Aug 31, 2011 8:49 pm
Posts: 495
Location: Somewhere between Heaven and Hell
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Thu Aug 17, 2017 2:34 pm 
Their code is highly likely to be superior, but here's the .txt as you've requested. Glad you got it working =D


theCode.txt [2.37 KiB]
Downloaded 6 times

_________________
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

Image
Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Fri Aug 18, 2017 11:05 am 
That worked like a champ, Xaelvaen, thanks!!

Thanks to all players for helping get through this! Much appreciated!

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Aug 31, 2011 8:49 pm
Posts: 495
Location: Somewhere between Heaven and Hell
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Fri Aug 18, 2017 1:34 pm 
You're very welcome. How is 5E working out for you? That's pretty much our classic fantasy go-to for tabletop (and Shadowrun Anarchy for anything non-traditional fantasy) - always happy to see others using it =)

_________________
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

Image


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Thu Jun 01, 2006 1:05 pm
Posts: 5538
Location: Buffalo, NY
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Fri Aug 18, 2017 1:40 pm 
Xaelvaen wrote:
You're very welcome. How is 5E working out for you? That's pretty much our classic fantasy go-to for tabletop (and Shadowrun Anarchy for anything non-traditional fantasy) - always happy to see others using it =)


I've played all versions of D&D since 3.0 and hands down think 5e is the best of the bunch. :)

_________________
How to use my bundled artwork (MT1.3B60+): http://forums.rptools.net/viewtopic.php?f=8&t=11759


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Aug 31, 2011 8:49 pm
Posts: 495
Location: Somewhere between Heaven and Hell
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Sun Aug 20, 2017 10:13 am 
Couldn't agree more, though I played 2nd edition as well, and it's still a close favorite. Cheers and happy gaming =)

_________________
"An arrogant person considers himself perfect. This is the chief harm of arrogance. It interferes with a person's main task in life - becoming a better person." - Leo Tolstoy

Image


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Mon Jul 18, 2011 12:10 pm
Posts: 682
Location: Toronto
 Post subject: Re: Modfiy to add advantage/disadvantage
PostPosted: Wed Sep 20, 2017 9:26 am 
Got this working in my 4e (tried 5e once and found it too simplistic; wasn't happy there was no DDI) fw. Go to this page, scroll down to "The MacroPolicebox Group" and watch the last video (named "Toggles"). You can make your output private by using Silent Running Mode and do advantage/disadvantage with d20 Choice Mode.

_________________
StarMan - The MacroPolicebox D&D 4E Framework: Import ANYTHING!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 24 posts ]  Go to page Previous  1, 2

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