there is also a floor() function, which you may prefer...it always rounds down, which is more appropriate for D&D style stuff...since it follows the rules of rounding for D&D.ltwally wrote:Current Quest: is there a round() function? (So that when I do a LEVEL/2, I can chop off the .5 at the end of odd levels.)
Nevermind - I found it.
scripting?
Moderators: dorpond, trevor, Azhrei
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.
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.
0+0=1, for very unstable CPUs.
Sorta off-topic, but maybe something the devs could some day look into us using LuaJava to include an actual scripting language. Maybe for the some day 1.4 branch. An actual language (and Lua is easy to learn/use) could open up so many possibilities.
There's been talk of a number of scripting languages, but I think the default choice will probably be javascript.syntruth wrote:Sorta off-topic, but maybe something the devs could some day look into us using LuaJava to include an actual scripting language. Maybe for the some day 1.4 branch. An actual language (and Lua is easy to learn/use) could open up so many possibilities.
I keep hounding on multisupport, with python, javascript and others making the regular mention. But lua sounds good to me.
Essentially anything that has a free java plugin has a pretty good chance of making it.
It will happen someday, but 1.4 is a good timeline.
0+0=1, for very unstable CPUs.
Yeah, I've been using FLOOR().
Having a hard time with EVAL(), though.
Here is some sample code for a healing spell. I think it's pretty obvious:
It doesn't work though. Not at all. Not when LEVEL is 5, or 6, or 200.
I've tried replacing the comma in EVAL with a +. That did nothing to fix it.
Any ideas?
Having a hard time with EVAL(), though.
Here is some sample code for a healing spell. I think it's pretty obvious:
Code: Select all
Myself or one ally can spend a healing surge plus [eval(floor(LEVEL/5), "d6")] hp.
I've tried replacing the comma in EVAL with a +. That did nothing to fix it.
Any ideas?
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
Try [eval("" + floor(LEVEL/5) + "d6")]. By starting with a string, you force it to interpret + as concatenation instead of addition. (Of course, I'm at work at the moment and can't test it, but I think that should work.)ltwally wrote:Yeah, I've been using FLOOR().
Having a hard time with EVAL(), though.
Here is some sample code for a healing spell. I think it's pretty obvious:It doesn't work though. Not at all. Not when LEVEL is 5, or 6, or 200.Code: Select all
Myself or one ally can spend a healing surge plus [eval(floor(LEVEL/5), "d6")] hp.
I've tried replacing the comma in EVAL with a +. That did nothing to fix it.
Any ideas?
You don't actually need eval in this case, though; you can use [roll(floor(LEVEL/5), 6)].
I ended up giving up on EVAL(). Turns out it wasn't really necessary.
It's not super-pretty... but it works.
Code: Select all
<br>Myself or one ally can spend a healing surge plus <b>{roll(min(floor((LEVEL-1)/5),5)+1,6)}</b> hp.
Yeah, that's what I was going to suggest. eval is mostly used when storing dice rolls in properties. If you have a propterty called FOO with a value of d6 and you have this macro:ltwally wrote:I ended up giving up on EVAL(). Turns out it wasn't really necessary.
It's not super-pretty... but it works.Code: Select all
<br>Myself or one ally can spend a healing surge plus <b>{roll(min(floor((LEVEL-1)/5),5)+1,6)}</b> hp.
Code: Select all
You did {FOO} damage
Code: Select all
You did d6 damage
Code: Select all
You did {eval(FOO)} damage
Code: Select all
You did 4 damage
as for more scripting logic don't expect must for 1.3... build 1.3 is in its polishing stages, so no new updates will be made... trevor will be starting 1.4 in the near future (near as in whenever people stop finding bugs for 1.3) and with 1.4 there are a lot of new additions trevor plans... from what i've heard, he wants to allow much more then just scripting, but building of modules and such to create addons... of course everything is subject to when he actually starts working on it... but with the extra help he's been getting recently... we can expect great things from rptools... a hazzah to the new devs, and the head dev trevor!
Another scripting question:
Does anyone know of a way to do some math and have the results stored in a variable without it being displayed in the chat window??
In some of my macros, I have really long damage rolls. I store them in variables so I can display the result in multiple places, and show things like half-damage on a miss and such. But that huge ugly roll at the top... undesirable.
If you have any ideas: Thanks!!
Does anyone know of a way to do some math and have the results stored in a variable without it being displayed in the chat window??
In some of my macros, I have really long damage rolls. I store them in variables so I can display the result in multiple places, and show things like half-damage on a miss and such. But that huge ugly roll at the top... undesirable.
If you have any ideas: Thanks!!
Before build b41 I liked to use html comments:ltwally wrote:Another scripting question:
Does anyone know of a way to do some math and have the results stored in a variable without it being displayed in the chat window??
In some of my macros, I have really long damage rolls. I store them in variables so I can display the result in multiple places, and show things like half-damage on a miss and such. But that huge ugly roll at the top... undesirable.
If you have any ideas: Thanks!!
Code: Select all
<!-- [MyRoll=d20] -->You do {MyRoll} damage!
Code: Select all
[H:MyRoll=d20]You do {MyRoll} damage!