|
|
|
|
| View previous topic :: View next topic |
| Author |
Message |
Zag
Tired of his old title
|
Posted: Tue Oct 07, 2008 3:24 pm Post subject: 1 |
|
|
Hi!
I love the "dice" feature you've added to the forums. We've been using it a lot in my D&D thread. I was wondering if I could make a modification to it specifically for D&D? We are often rolling initiative, attack, and damage all together, and then there are special qualifiers if the attack roll scores a critical hit which then requires an extra roll and possibly affects the damage. I wanted to add some special code for that combination so that it does all the rolls with one command. (Or possibly just make a new command for D&D attack rolls.)
What language is it written in? I'm an experienced software engineer, so, even if is a language I've never used (which is unlikely), I can probably puzzle out the syntax from the existing code. If you don't want to give me whatever privileges I would need to access it, you could send me the code, I'll hack it up and send it back.
Thanks,
Zag |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Oct 07, 2008 4:48 pm Post subject: 2 |
|
|
It's in php. I can send it to you in a couple of days (Yom Kippur is upon us). _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Tue Oct 07, 2008 7:36 pm Post subject: 3 |
|
|
Cool! Thanks,
Here is my plan:
This new code will only be activated if the first character is an i or an a, so existing dice strings will not be affected.
D&D string := [<initiative>][<attack>]
initiative := i <modifier>
--- rolls a random d20+modifier, displays as "Initiative: <result>"
Note that the dice command uses space as a delimiter between separate commands, so that can not be used inside a D&D string. Therefore, it is allowable to put a slash between the different pieces, though it is optional.
attack := a <modifier>[h<damage string>][t<threat point>][c<multiplier>] [s<strength adjustment>][b<backstab level>]
modifier := num | +num | -num
-- This is a value added to the result of a d20 for both initiative and attack rolls
<damage string> : The weapon damage ('h' is for hurt, since d produces ambiguity). This can be any type of string that would normally be in a non-D&D dice roll: i.e. 2d8+2. It defaults to 1d6
[t <threat point>] : The point at which the natural roll (that is, before the modifier is added) for the attack means that the roll indicates a "threat." When this is exceeded, an extra attack roll will be made to determine if the critical damage should be applied. Also, the damage rolled will be indicated for both a critical and a non-critical hit. The default threat point if not specified is 20, but some weapons have a threat point of 19 or even 18.
[c <multiplier>] : The number of times damage should be rolled for the critical damage (and summed). The default is 2, but some weapons have more, all the way up to 5. (Note that all weapons have the default value for either the threat point or the crit multiplier, so no user would ever have to enter both of these.)
[s <strength adjustment>] : Adjustment to damage due to strength, in the same format as the modifier. This must be separated from the damage value because it does not get multiplied in a critical hit.
[b <backstab level>] : Backstab level, indicates that this is a backstab (i.e. a sneak attack in the new parlance) and additional damage is applied. It is <b>d6 for a normal attack, and <b>d6 + <b>*(<c>-1) for a critical hit. (Note that this is a non-sanctioned modification to the official D&D rules. According to official rules, backstabbing or not does not produce any additional damage on a critical hit.)
----------
Some examples. The first is the most normal type of entry, initiative, attack, and damage. This requires three "dice" commands today.
i3a6hd6+1
This says that the player has
i3: +3 on his initiative roll
a6: +6 on his attack roll
hd6+1: The weapon does d6+1 damage.
Result might be:
-------------------------
Initiative: (d20+3): rolled 14 +3 = 17
Attack: (d20+6): rolled 9 +6 = 15
Damage: (d6+1): rolled 4
-------------------------
Or, for the same string, if the attack roll caused a threat, then an additional "crit roll" is necessary, plus additional damage rolls. These would be done automatically.
-------------------------
Initiative: (d20+3): rolled 14 +3 = 17
Attack: (d20+6): rolled 20 +6 = 26
Crit roll: (d20+6): rolled 17 +6 = 23
Damage: (d6+1): rolled 4
Critical: (+d6+1): rolled 3 for total: 7
-------------------------
A complicated example: A 5th-level rogue (backstab level 3) with a 12 strength (+1 strength modification) backstabbing with a rapier (damage is 1d6, threat point of 18) would enter this string and might receive the following.
a8h1d6t18s1b3
-------------------------
Attack: (d20+8): rolled 19 +8 = 27
Crit roll: (d20+8): rolled 5 +8 = 13
Damage: (1d6): rolled 5, plus strength bonus +1, for total: 6
Backstab: (3d6): rolled 11 for total 17
Critical: (d6): rolled 3, plus backstab crit bonus +3, for total: 23
-------------------------
Last edited by Zag on Tue Jan 13, 2009 6:57 pm; edited 4 times in total |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Mon Oct 13, 2008 10:12 pm Post subject: 4 |
|
|
| bump. (Did you send it? I haven't received it.) |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Thu Oct 30, 2008 5:36 pm Post subject: 5 |
|
|
| Zag wrote: |
| bump. (Did you send it? I haven't received it.) |
|
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Sun Nov 09, 2008 4:39 pm Post subject: 6 |
|
|
Sent now with a very basic explanation to the email address in your profile. _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Sun Nov 09, 2008 5:12 pm Post subject: 7 |
|
|
Hmm. Well, it looks like my D&D game has died for lack of participation, so I'm a lot less interested. But I'll take a look, anyway. |
|
| Back to top |
|
 |
jeep
Daedalian Member
|
Posted: Mon Dec 29, 2008 8:52 pm Post subject: 8 |
|
|
If we plan to go to phpBB 3.0, it will be much better to wait until then to implement any new dice changes based on my new code (which makes dice results unchangeable).
-JEEP
PS (Sorry for the necro, I've been away for a while, but should be back for a while, again.) |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Dec 30, 2008 6:42 am Post subject: 9 |
|
|
We don't plan to upgrade the GL to phpBB 3.0, and in fact I've merged Zag's code with our a while ago. This bump hopefully shamed me enough for dawdling that I'll upload everything tonight  _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Tue Dec 30, 2008 12:43 pm Post subject: 10 |
|
|
| Antrax wrote: |
in fact I've merged Zag's code with our a while ago. This bump hopefully shamed me enough for dawdling that I'll upload everything tonight  |
Really? Have you run it at all? Did it even compile (or whatever the equivalent for PHP code is)?
Writing code in a language I've never used with no chance to test -- not even a syntax checker, was a little daunting. But I stared at it quite a bit more than I would normally, so I think it should only need some minor adjustments. |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Dec 30, 2008 2:16 pm Post subject: 11 |
|
|
Ah, that's the problem. php is interpreted, and I don't know of an easy way to install a development environment for php on a desktop. So, what I usually do is fix things to the best of my ability (made easier thanks to Beyond Compare) and then update the GL's code at US night time, see what breaks, debug with printf (echo) until I find the problem, etc. It's an annoying process, but not an impossible one. _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Dec 30, 2008 6:36 pm Post subject: 12 |
|
|
Well, I'm impressed. It seems that other than minor syntax issues (some missing semicolons and an unterminated string) your code works out of the box. Feel free to test it a bit in this thread, it's been about 20 years since I've played D&D so I can't really tell if the rolls make sense. I this we have some issues with the separators, but I'm not 100% sure what you were going for there. _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Dec 30, 2008 6:42 pm Post subject: 13 |
|
|
That was premature. Damage is acting up. Debugging now. _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Dec 30, 2008 6:55 pm Post subject: 14 |
|
|
Got it, another silly syntax error. However, it's still acting strange... _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Dec 30, 2008 7:10 pm Post subject: 15 |
|
|
Okay, I think it's ready. Nothing major, one small lapse when using substr, some typos. Just verify the parts where the die roll string is not 1dsomething, because I'm not sure they work like you want them to, but again, rusty on D&D. _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Tue Dec 30, 2008 9:40 pm Post subject: 16 |
|
|
| Dice Roll: | Original Roll String: i3a6hd6+1 Fixed Initiative: (d20+3): rolled 4+3 = 7 Attack: (d20+6): rolled 4+6 = 10 Damage: (d6+1): rolled 6
|
| Dice Roll: | Original Roll String: a8h1d6t18s1b3 Fixed Attack: (d20+8): rolled 1+8 = 9 Damage: (1d6): rolled 4, bonus +1 (5) for Total: 5 Backstab: (3d6): rolled 11 for Total: 15
|
| Dice Roll: | Original Roll String: i3a6hd6+1 Fixed Initiative: (d20+3): rolled 8+3 = 11 Attack: (d20+6): rolled 14+6 = 20 Damage: (d6+1): rolled 3
|
| Dice Roll: | Original Roll String: a8h1d6t18s1b3 Fixed Attack: (d20+8): rolled 5+8 = 13 Damage: (1d6): rolled 4, bonus +1 (5) for Total: 5 Backstab: (3d6): rolled 12 for Total: 16
|
| Dice Roll: | Original Roll String: i3a6hd6+1 Fixed Initiative: (d20+3): rolled 2+3 = 5 Attack: (d20+6): rolled 17+6 = 23 Damage: (d6+1): rolled 2
|
| Dice Roll: | Original Roll String: a8h1d6t18s1b3 Fixed Attack: (d20+8): rolled 18+8 = 26 Crit roll: (d20+8): rolled 5+8 = 13 Damage: (1d6): rolled 4, bonus +1 (5) for Total: 5 Backstab: (3d6): rolled 10 for Total: 14 Critical: (+1d6): rolled 1, backstab crit bonus +3 (4) for Total: 18
|
| Dice Roll: | Original Roll String: i3a6hd6+1 Fixed Initiative: (d20+3): rolled 15+3 = 18 Attack: (d20+6): rolled 18+6 = 24 Damage: (d6+1): rolled 3
|
| Dice Roll: | Original Roll String: a8h1d6t18s1b3 Fixed Attack: (d20+8): rolled 12+8 = 20 Damage: (1d6): rolled 6, bonus +1 (7) for Total: 7 Backstab: (3d6): rolled 10 for Total: 16
|
Cool! I see a couple of bugs, though. Send me your modified version and I'll fix them.
1. When comparing to threat level, it should be using the unmodified d20 roll.
2. It isn't carrying the strength bonus into the total when there is additional damage from backstab and/or crit
3. Using OR bars to separate the pieces of a single command somehow caused it to fail.
4. Separating multiple rolls by space is failing, even with old-style dice commands. (A little-known feature, but it definitely did used to work.)
---
testing that old functionality still works
| Dice Roll: | Original Roll String: 1d20+5 Fixed 1 20-Sided Dice Results: (12) + 5 (Total = 17) br> |
| Dice Roll: | Original Roll String: d20 Fixed 20-Sided Dice Results: 6 br> |
| Dice Roll: | Original Roll String: 4d6 Fixed 4 6-Sided Dice Results: 2, 2, 4, 5 (Total = 13) br> |
| Dice Roll: | Original Roll String: d100 d20 d12 d8 d6 d4 Fixed 100-Sided Dice Results: 30+3(33) br> 20-Sided Dice Results: 19 br> 12-Sided Dice Results: 6 br> 8-Sided Dice Results: 4 br> 6-Sided Dice Results: 1 br> 4-Sided Dice Results: 2 br> |
| Dice Roll: | Original Roll String: 1d20 1d20 1d20 Fixed 1 20-Sided Dice Results: 7 br>1 20-Sided Dice Results: 1 br>1 20-Sided Dice Results: 2 br> |
Hmm. It looks like multiple rolls separated by space is not working.
[dice]1d20,1d20, 1d20 [/dice]
Last edited by Zag on Wed Dec 31, 2008 2:57 am; edited 1 time in total |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Wed Dec 31, 2008 2:26 am Post subject: 17 |
|
|
| Dice Roll: | Original Roll String: a4h2d6 Attack: (d20+4): rolled 20+4 = 24 Crit roll: (d20+4): rolled 14+4 = 18 Damage: (2d6): rolled 3 Critical: (+2d6): rolled 6 for Total: 9
|
[dice]a4|h2d6[/dice] |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Mon Jan 05, 2009 3:55 pm Post subject: 18 |
|
|
For some reason, or bars still don't work and damage rolls don't take their bonus. Odd. _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Mon Jan 05, 2009 8:33 pm Post subject: 19 |
|
|
No, the bug with damage seems fixed.
| above wrote: |
Original Roll String: a8h1d6t18s1b3 Fixed
Attack: (d20+8): rolled 1+8 = 9
Damage: (1d6): rolled 4, strength bonus +1 (5) for Total: 5
Backstab: (3d6): rolled 11 for Total: 16 |
This has been showing the last line as (bold mine)
| above wrote: |
Original Roll String: a8h1d6t18s1b3 Fixed
Attack: (d20+8): rolled 1+8 = 9
Damage: (1d6): rolled 4, strength bonus +1 (5) for Total: 5
Backstab: (3d6): rolled 11 for Total: 15 |
|
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Mon Jan 05, 2009 8:35 pm Post subject: 20 |
|
|
Trying to get one with a crit, now that they are (correctly) a lot harder to get
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 2+8 = 10 Damage: (d6): rolled 4, bonus +2 (6) for Total: 6
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 18+8 = 26 Crit roll: (d20+8): rolled 9+8 = 17 Damage: (d6): rolled 1, bonus +2 (3) for Total: 3 Critical: (+d6): rolled 5 for Total: 6
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 8+8 = 16 Damage: (d6): rolled 3, bonus +2 (5) for Total: 5
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 10+8 = 18 Damage: (d6): rolled 1, bonus +2 (3) for Total: 3
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 20+8 = 28 Crit roll: (d20+8): rolled 8+8 = 16 Damage: (d6): rolled 6, bonus +2 (8) for Total: 8 Critical: (+d6): rolled 2 for Total: 8
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 17+8 = 25 Crit roll: (d20+8): rolled 10+8 = 18 Damage: (d6): rolled 5, bonus +2 (7) for Total: 7 Critical: (+d6): rolled 6 for Total: 11
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 16+8 = 24 Damage: (d6): rolled 3, bonus +2 (5) for Total: 5
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 10+8 = 18 Damage: (d6): rolled 1, bonus +2 (3) for Total: 3
|
| Dice Roll: | Original Roll String: a8t17s2 Attack: (d20+8): rolled 13+8 = 21 Damage: (d6): rolled 5, bonus +2 (7) for Total: 7
| |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Mon Jan 05, 2009 8:41 pm Post subject: 21 |
|
|
Also, spaces seems to be fixed, again.
| Dice Roll: | Original Roll String: d100 d20 Fixed 100-Sided Dice Results: 30+8(38) br> 20-Sided Dice Results: 16 br> |
Trying comma
[dice]d100,d20[/dice]
Nope. Didn't work. And why did it think that there was a +8 on the d100? Hmmm. It seems it did it above, too, but only on the d100. I seem to remember that d100 got some special handling -- I wonder if that path is also missing an initializer. I'm at work so I don't have the code in front of me.
Oh, wait -- I remember. For some reason, it wanted to show the two dice of a "d100" separately, and then show them together. Perhaps what we are seeing is correct.
| Dice Roll: | Original Roll String: d20 d20 Fixed 20-Sided Dice Results: 19 br> 20-Sided Dice Results: 19 br> | |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Mon Jan 05, 2009 9:19 pm Post subject: 22 |
|
|
Other than it choking on the OR bar and not accepting comma as a separator (both minor, easy-to-live-without features), it seems all the bugs are fixed. Thanks, Antrax!
It's too bad my D&D game has died. Maybe I'll troll some D&D sites to find more dedicated players and start another game by tempting them over here. |
|
| Back to top |
|
 |
Antrax
ESL Student
|
Posted: Tue Jan 06, 2009 10:51 am Post subject: 23 |
|
|
On my test thread (in a hidden forum) I got bad results for damage when rolling d6+1 for instance (it would just show "rolled X" and not add the bonus). Is this me misunderstanding D&D or a bug? _________________ After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick! |
|
| Back to top |
|
 |
Zag
Tired of his old title
|
Posted: Tue Jan 13, 2009 6:40 pm Post subject: 24 |
|
|
Well, the game is truly dead. I'm a little sad, since I had one of my favorite scenarios coming up soonish.
| Antrax wrote: |
| Is this me misunderstanding D&D or a bug? |
Neither. I suspect that the code is doing the right thing but saying it poorly: It adds the +1, but it isn't telling you about the actual die roll as it does with other rolls. (pretty inconsistent, that.) That is, a damage of d6+1 will "roll" a number from 2 to 7, because I am deferring to the other method (the regular dice command) to roll it and getting only a single number back. Checking it below.
[edit] Sure enough, the numbers range from 2 to 7. (I deleted a lot of rolls, but these were the lowest and highest for damage.)[/edit]
| Dice Roll: | Original Roll String: a1hd6+1 Fixed Attack: (d20+1): rolled 6+1 = 7 Damage: (d6+1): rolled 2
|
| Dice Roll: | Original Roll String: a1hd6+1 Fixed Attack: (d20+1): rolled 3+1 = 4 Damage: (d6+1): rolled 7
| |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|