
Pages:<< prev 1 next >>



Fledgling

GroupMembers
Posts19
JoinedMar 18, 2009
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?



Fledgling

GroupMembers
Posts19
JoinedMar 18, 2009
this is the quick version 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:
[code]
>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
[code]
You say 'roll dice'
you rolled a 12
you rolled a 8
here is the program:
[code]
>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
[code]



Magician

GroupMembers
Posts189
JoinedSep 5, 2010
actually, that prog will only show one response of "you rolled a #". If it's showing 2 responses for you, pentair, you may want to look into that as a bug.



Fledgling

GroupMembers
Posts19
JoinedMar 18, 2009
Hmm. It is a dbna src, so its probly very buggy. I will have to look into it later when im not on an Ipad



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
Well It has been a long time but I think it is doing it once for the word roll and once for the word dice. Try doing the speech_prog 'roll dice' instead of roll dice. A good way to test it is just say roll in the room if it does it once there you go.



Sorcerer

GroupMembers
Posts600
JoinedDec 3, 2008
btw what mud is this?



Conjurer

GroupMembers
Posts395
JoinedMar 8, 2005
It ought to show a somewhat random number of responses, since it calls rand() multiple times and makes decisions based off each, no?
I dunno... I never used mprogs or whatever you call them, but I'd have to believe each call to rand() would generate a new random number.
I dunno... I never used mprogs or whatever you call them, but I'd have to believe each call to rand() would generate a new random number.



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
Yea Quix, each call to rand will get a different number. But the basics of it are that it doesn't have variables you can set like
Granted that would be the best way to have it work but it isn't set up like that lol.
dice1 = rand(); dice2 = rand(); if dice1(1) && dice2(2) say you rolled a 3. endif
Granted that would be the best way to have it work but it isn't set up like that lol.



Fledgling

GroupMembers
Posts19
JoinedMar 18, 2009
The code is just dbna from here. I compiled it to test progs before I tried them on the actual mud I am building on. I will try the 'roll dice' It didn't occur to me.
And the rand(#) is the only way I could think of to do it. If hernes calculations are correct they should all have roughly the same % chance to occur. Should be somewhere around 9%. But now that I see it Im pretty sure it's the missing ' '. I will try it out and letbu know. Thanks for the help.
And the rand(#) is the only way I could think of to do it. If hernes calculations are correct they should all have roughly the same % chance to occur. Should be somewhere around 9%. But now that I see it Im pretty sure it's the missing ' '. I will try it out and letbu know. Thanks for the help.



Magician

GroupMembers
Posts189
JoinedSep 5, 2010
oh, that's right...forgot that without quotes it counts all the words. heh



Sorcerer

GroupMembers
Posts600
JoinedDec 3, 2008
Another opinion you could go for this is having the coder actually make a Dice command, and a dice program type and then have the area pick up on the echo of the command. It won't be that hard to make. If you needed I could make one for you. I am used to working with dbsaga so yeah.



Conjurer

GroupMembers
Posts395
JoinedMar 8, 2005
Has anyone though of implementing a (limited) set of variables in the mprog system? I'm sure it wouldn't be all that difficult to have a fixed set (like a-z), and assignment via a function like store(a, 12).
If you don't want to deal with types, you could probably just make a handful of variables like i1 i2.. i9, and s1 s2... s9.
*shrug*
If you don't want to deal with types, you could probably just make a handful of variables like i1 i2.. i9, and s1 s2... s9.
*shrug*



Sorcerer

GroupMembers
Posts723
JoinedMar 5, 2005
I have a variable system in my MUD and I think it was a Smaug snippet. "setvar" etc. Also I thought Smaug 1.8 had something like that?



Fledgling

GroupMembers
Posts19
JoinedMar 18, 2009
I got it working, it was the apostrophys (sp?). Apparently i could have used p too. Like rpedit add speech p roll dice
any ways heres what i came up with. and how do u get the codebox to work? it just puts codbox in quotes for me.
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
any ways heres what i came up with. and how do u get the codebox to work? it just puts codbox in quotes for me.
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


Off the Edge of the Map

GroupAdministrators
Posts1,199
JoinedMar 21, 2006
The latest version of SmaugFUSS has the variables code, Zeno mentioned in it.



Apprentice

GroupMembers
Posts58
JoinedNov 22, 2010
Hello:
I've seen the term "DBNA code" in some different places, but I've never looked for it. I think that it's a Dragon Ball code, but I've never find it to download. Can somebody tells me where is the code to download and look it?
Thanks for all,
Antram
I've seen the term "DBNA code" in some different places, but I've never looked for it. I think that it's a Dragon Ball code, but I've never find it to download. Can somebody tells me where is the code to download and look it?
Thanks for all,
Antram
Pages:<< prev 1 next >>