Jump to content

Rolling trigger


kamikazi

Recommended Posts

For the following trigger, make sure it matches Perl Regular Expression (I could edit it to recognize cscript/zscript instead, if you need me to).

 

#TRIGGER {^\[(\d{1,2})\] Cmds: help, end, roll, add, rem>} {#IF (%1 < @targetroll AND @statting) {#add rolls 1;roll} {#VAR statting 0;#MESS We finished statting! Allocate points!}
#IF (%1 > @highestroll) {#VAR highestroll %1;#VAR highesttimes 0}
#IF (%1 = @highestroll) {#ADD highesttimes 1}
#IF (@rolls < 10000) {#VAR targetroll 30}
#SAY You have rolled @rolls amount of times and the highest roll so far was @highestroll. You have rolled this @highesttimes amount of times. Currently, you are trying to roll for @targetroll.
#IF (@rolls = 10000) {#VAR targetroll @highestroll}}

 

You'll also need some sort of trigger (or alias, if you prefer) to reset variables each time you make a character. For some reason, my cmud was misbehaving a bit for this and I had to execute the script manually:

 

#TRIGGER {^Abandon hope, all ye who enter here...$} {#VAR rolls 0
#VAR statting 1
#VAR highestroll 0}

 

EDIT:

So what does all that stuff do?

 

It gives you a roller that looks like this:

 

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[16] Cmds: help, end, roll, add, rem>  
roll
You have rolled 35 amount of times and the highest roll so far was 20. You have rolled this 5 amount of times. Currently, you are trying to roll for 30.

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[15] Cmds: help, end, roll, add, rem>  
roll
You have rolled 36 amount of times and the highest roll so far was 20. You have rolled this 5 amount of times. Currently, you are trying to roll for 30.

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[16] Cmds: help, end, roll, add, rem>  
roll
You have rolled 37 amount of times and the highest roll so far was 20. You have rolled this 5 amount of times. Currently, you are trying to roll for 30.

 

After 10,000 rolls, it picks the highest roll you had and starts rolling for that. Let me break it down line by line:

 

1.

#IF (%1 < @targetroll AND @statting) {#add rolls 1;roll} {#VAR statting 0;#MESS We finished statting! Allocate points!}

 

This means that if your newest roll (i.e [15] or [16] or [18]) is lower than your target variable and the statting variable is active (1 instead of 0), the trigger will 'roll', and add 1 to the rolls variable. If your newest roll is equal to or higher than your current target variable, or the statting variable is inactive (0 instead of 1), the trigger will send a message that says "We finished statting! Allocate points!".

 

 

2.

#IF (%1 > @highestroll) {#VAR highestroll %1;#VAR highesttimes 0}

 

This means that if your newest roll (i.e [15] or [16] or [18]) is higher than the highestroll variable, it will become your new highestroll variable. It will also reset the highesttime variable to 0.

 

 

3.

#IF (%1 = @highestroll) {#ADD highesttimes 1}

 

This means that if your newest roll is equal to the highestroll variable, it adds one to the highesttimes variable.

 

 

4.

#IF (@rolls < 10000) {#VAR targetroll 30}

 

This means that if you have rolled less than ten thousand rolls, it will automatically set your target to 30. This is mostly since I have no idea what the highest roll is for any of the class/race combinations, and the roller will typically hit the ceiling in less than ten thousand rolls. If you know how high you're aiming for, just change the '30' to whatever number you want the roller to stop at.

 

 

5.

#SAY You have rolled @rolls amount of times and the highest roll so far was @highestroll. You have rolled this @highesttimes amount of times. Currently, you are trying to roll for @targetroll.

 

This part part is what adds the 'You have rolled 2479 amount of times and the highest roll so far was 25. You have rolled this 2 amount of times. Currently, you are trying to roll for 30.' line after each roll.

 

 

6.

#IF (@rolls = 10000) {#VAR targetroll @highestroll}}

 

This last part of the trigger changes your targetroll to the highestroll variable after 10,000 rolls. If you decrease the number here, remember to do the same in the "#IF (@rolls < 10000) {#VAR targetroll 30}" part of the trigger.

 

 

This should provide a pretty good example of how the #IF statement works for zscript/cscript. I am not a proper coder and don't really know all that much about scripting, but the #IF statement can do some nifty things if you understand how it works.

 

For example, let's assume you track whether or not you have sanctuary up, and use a target variable when PK'ing people:

 

#ALIAS {murd} {#IF (!@sanctuary OR !@greenaura) {#ECHO Ar-mah-god, you're not even using sanctuary! Stahp!;murder @target} {murder @target}}

 

Conditions in the paranthesis can be used with AND to add a secondary condition that must also be fulfilled, or OR for a different, separate condition. The first bracket after the parenthesis is what happens if the conditions inside the parenthesis are all fulfilled. The second bracket (which is optional) after the paranthesis is what happens if the conditions inside the paranthesis are not met.

 

And lastly, this is how it all ends:

 

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[15] Cmds: help, end, roll, add, rem>  
roll
You have rolled 10418 amount of times and the highest roll so far was 25. You have rolled this 5 amount of times. Currently, you are trying to roll for 25.

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[22] Cmds: help, end, roll, add, rem>  
roll
You have rolled 10419 amount of times and the highest roll so far was 25. You have rolled this 5 amount of times. Currently, you are trying to roll for 25.

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[22] Cmds: help, end, roll, add, rem>  
roll
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 5 amount of times. Currently, you are trying to roll for 25.

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[25] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 6 amount of times. Currently, you are trying to roll for 25.


Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14
[25] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.
add str 5

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 19  Int: 14  Wis: 14  Dex: 14  Con: 14
[20] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.
add int 3

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 19  Int: 17  Wis: 14  Dex: 14  Con: 14
[17] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.
add wis 4

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 19  Int: 17  Wis: 18  Dex: 14  Con: 14
[13] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.
add dex 8

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 19  Int: 17  Wis: 18  Dex: 22  Con: 14
[5] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.
add con 2

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 19  Int: 17  Wis: 18  Dex: 22  Con: 16
[3] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.
add int 3
You have no picks remaining, use "end" to continue.

Rolling stats for half-elf monk.:
Max: Str: 19  Int: 21  Wis: 20  Dex: 22  Con: 18
Cur: Str: 19  Int: 20  Wis: 18  Dex: 22  Con: 16
[0] Cmds: help, end, roll, add, rem>  
You have rolled 10420 amount of times and the highest roll so far was 25. You have rolled this 7 amount of times. Currently, you are trying to roll for 25.

 

I realized I was a bit lazy when I wrote this, because that echo doesn't need to be visible if the @statting variable isn't active. But, well, that's how it goes. It took me maybe five minutes to make this script, and then another 10 minutes to make all the numbers be added properly to get it all work the way I wanted. If you need any help with other basic zmud/cmud scripts, I'd be happy to help (though I might not be able to do advanced thingies for you).

Link to comment
Share on other sites

I use this.  Does the same thing as hers and even breaks down what you roll.  You also don't need to Perl Regular Expressions.  I also give you the trigger to reset variables and turn off/on your rolling folder.  The only thing you'll need to do manually is to check the box on the folder Rolling that states "disable when connecting to the mud".
 

 #TRIGGER {~[(%d)~] Cmds} {  #ad count 1  #ad %1 1  #var total %1  %if( @total < @minn, "roll", "#echo disablerollingtrigger")  big = %if( @total >= @big, @total, @big)  #say ~# of Rolls~: @count, Largest~: @big, Minimum~: @minn, Current~: @total  #say 18~:@18 19~:@19 20~:@20 21~:@21 22~:@22 23~:@23 24~:@24 25~:@25 26~:@26 27~:@27  } {Rolling} #TRIGGER {Do you wish to view the Adventurer class information~?} {#class Rolling 1:#va 15 0:#va 16 0:#va 17 0:#va 18 0:#va 19 0:#va 20 0:#va 21 0:#va 22 0:#va 23 0:#va 24 0:#va 25 0:#va 26 0:#va 27 0:count=0:big=0}#TRIGGER {disablerollingtrigger} {#class Rolling 0}#ALIAS max {#va minn %1} {Rolling}

 

Top one is the rolling trigger that creates itself in a new folder entitled "Rolling".

The second turns on the folder when you're soon to roll and resets all variables in the trigger.

Third one is the trigger that turns off the folder when your target number is rolled.

The alias makes it simple to set your max roll, even in middle of the rolling.  Simply type something like "Max 30" and it'll (try to) roll til you get it.  It also creates itself in the folder Rolling to prevent you from using the alias outside of rolling.

 

For a view of what this looks like:

Rolling stats for human warrior.:Max: Str: 21  Int: 20  Wis: 20  Dex: 20  Con: 20Cur: Str: 14  Int: 14  Wis: 14  Dex: 14  Con: 14[19] Cmds: help, end, roll, add, rem>  roll# of Rolls: 9, Largest: 19, Minimum: 30, Current: 1918:1 19:1 20:0 21:0 22:0 23:0 24:0 25:0 26:0 27: 0
Link to comment
Share on other sites

Variables are easily changed both in aliases and triggers. Due to laziness, I also generally don't use folders unless I'm playing one of the IRE muds, because such many complicated triggers/aliases. It's a pretty good habit to put all triggers/aliases into folders for the specific script, though.

 

Now, allow me to pilfer some of Magick's excellent ideas for my own rolling needs.

 

:ninja:

Link to comment
Share on other sites

By all means, Vin.  I got the base of that from the forums and have made changes to it over the years.

 

 

With things like that is there any point to having people roll stats anymore?

 

That's been a topic of debate on more than one occasion.  Both sides are fairly represented and if memory serves, the Imms have looked into either replacing or revamping rolling.  I don't know where they're at or if they've scrapped the idea or if it's just way, way back on the back burner.  The point is, is the discussion was there.  If you've anything to add, or have another idea, by all means, start a new thread and print out a wall of text.

Link to comment
Share on other sites

With things like that is there any point to having people roll stats anymore?

 

 

I think it's just something carried over back from the dawn of muds, which were basically tabletop RPGs built into the world wide web. I remember in 1.0 when you didn't roll for a sum, but each stat individually. There were roller scripts back then, too, but I think they weren't as commonplace. But the same can be said for the level of scripting in pretty much all muds these days.

 

I personally wouldn't mind if rolling was done away for, but I'm not bothered by its existence either.

Link to comment
Share on other sites

I've always known that you are an idiot, but preferring to ask those nerds for a rolling trigger, when you can simply drop me a PM and get my exquisitely simple, one line roller presented to you in a way that even you can understand makes absolutely no sense :)

Link to comment
Share on other sites

Daimn, I am a lost cause when it comes to scripting, haha. Thanks guys.

 

 

 

Feel free to send me a message in case there's something that doesn't make sense, and I'll happily guide you step-by-step with how either of those rollers work. I'll even help you build your own roller if you'd like to. Also, if anyone has all the race/class max rolls, it'd be easy to do something along the lines of: #IF (@race=human AND @class=monk AND @statting AND %1<23) {roll}

 

Would need one trigger line for each class/race combination (I bet there's a tons easier way of doing this, but, alas, I'm not the best at scripting), but would always go for the max roll available for any race and class combination.

Link to comment
Share on other sites

What would be interesting is if you were forced to have an 'imperfect roll'.

 

What if stats were semi-randomized under a set of rules, so that every character is in effect 'different' and not a standard baseline set of stats and outcomes. 

 

It would make picking perks a hell of a lot more interesting to kind of balance what imperfections you had once you rolled.

Link to comment
Share on other sites

What you said makes no sense Aulian. Stats are not "standard" - even if you get a perfect roll you still have to pick a few stats which will not be maxed.

And secondly, perks have nothing to do with stats. Saying that you will try to balance stats with a perk selection is like saying that you will try to lower how much gasoline your car spends by drinking more water.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...