Please check out StormHunters !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. smaug random dice roomprog Sat Jun 11, 2011 [8:43 AM]
decus666
sprockfizzly@gmail.com
member since: Jan 15, 2010
Reply
I'm building an area based off a board game and I'm trying to figure out how to make prog that rolls 2 dice, then transports the player that many spaces. I got a basic one that takes a random number between 2 and 12, but was trying to make one that rolls 2 dice and adds them telling the player what the dice rolled. Is there a way to do this or do I have to make a if check for every dice roll possible?

this is the quick version with no transports, but it reports 2 rolls instead of one. ie:
You say 'roll dice'
you rolled a 12
you rolled a 8

here is the program:

>speech_prog roll dice
if rand(9)
mpe you rolled a 3
else
if rand(10)
mpe you rolled a 4
else
if rand(11)
mpe you rolled a 5
else
if rand(13)
mpe you rolled a 6
else
if rand(14)
mpe you rolled a 7
else
if rand(17)
mpe you rolled a 8
else
if rand(20)
mpe you rolled a 9
else
if rand(25)
mpe you rolled a 10
else
if rand(33)
mpe you rolled a 11
else
if rand(50)
mpe you rolled a 12
else
mpe you rolled a 2
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif


2. RE: smaug random dice roomprog Sat Jun 11, 2011 [10:16 AM]
Epilogy
Email not supplied
member since: Mar 9, 2006
In Reply To
Reply
I wouldn't rely on if rand for multiple rolls which are equally possible. You -can- but... expect some fishy results because of how the flow works.

The times when I have multiple if rand checks I do something more along the lines of

if rand 50
do this
break
endif

and repeat as needed.

I think the best way to do it would be to implement a diceroll command that could trigger with ACT. But, for a board game, I think you'd definitely want some kind of variables to play with in your mprogs.


3. RE: smaug random dice roomprog Sat Jun 11, 2011 [12:42 PM]
melopene
Email not supplied
member since: Oct 30, 2000
In Reply To
Reply
I would strongly suggest having your coder implement a 'dice'
command and integrate its functionality into mprogs. That way,
you could get the actual functionality you desire, and the
scripting would be much cleaner all around.


4. RE: smaug random dice roomprog Sat Jun 11, 2011 [2:39 PM]
decus666
Email not supplied
member since: Jan 15, 2010
In Reply To
Reply
Think the problem is, i didn't put apostrophies around roll dice so it was
activatining twice. I would like to have a actual random function added but
this is my first area and it's a trial position.


5. RE: smaug random dice roomprog Mon Jun 13, 2011 [12:13 PM]
Gatz
Email not supplied
member since: Jun 9, 2004
In Reply To
Reply
Glad to see you found a fix, but you could have kept the original thing you did but put a 'p' in front of the phrase. The 'p' tells the prog parser that you want the entire phrase, otherwise it matches on each word. In this case, twice.

Exmaple: rpedit VNUM speech p I like spam.

http://www.realmsofdespair.com/smaug/herne/smaug/olc-programs.html#RPT

Herne's Guide is a God-send and that points you to what I just described. I'm not 100% on the version of SMAUG (FUSS or not) you are using, but that guide is going to be about 80-90% accurate to the base you are using, most likely.
Owner of NarutoMUD
Join the fun today at http://narutofor.us/


6. RE: smaug random dice roomprog Mon Jun 13, 2011 [5:49 PM]
decus666
Email not supplied
member since: Jan 15, 2010
In Reply To
Reply
Cool i didnt know about the p thing. i got it working and heres what im going to use. not sure on the colours yet.

mpe &YTaking up your dice, you hope for a good roll and let them fly....&d
mpsleep 6
if rand(9)
mpe &Yyou rolled a &C3&d
mptransfer $n 220005
else
if rand(10)
mpe &Yyou rolled a &C4&d
mptransfer $n 220006
else
if rand(11)
mpe &Yyou rolled a &C5&d
mptransfer $n 220007
else
if rand(13)
mpe &Yyou rolled a &C6&d
mptransfer $n 220008
else
if rand(14)
mpe &Yyou rolled a &C7&d
mptransfer $n 220009
else
if rand(17)
mpe &Yyou rolled a &C8&d
mptransfer $n 220010
else
if rand(20)
mpe &Yyou rolled a &C9&d
mptransfer $n 220011
else
if rand(25)
mpe &Yyou rolled a &C10&S!&d
mptransfer $n 220012
else
if rand(33)
mpe &Yyou rolled a &C11&S!&d
mptransfer $n 220013
else
if rand(50)
mpe &Yyou rolled a &C12&S!&d
mptransfer $n 220014
else
mpe &Yyou rolled a &C2&d
mptransfer $n 220004
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif

thanks for the help all. :)




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]