Bolkral Steerpike Posted January 10, 2013 Share Posted January 10, 2013 I've seen some other assistance here before, but to ensure I properly understand, I thought I would ask again. I am trying to create a relatively simple dice script that will use modifiers, and roll a 100-sided dice randomly.All the script really needs to do is to randomly generate the number, so long as it won't also generate a 0 - as a 0 wouldn't make sense for the games in which the dice would be used, and say whom rolled it in local chat. (eg. "<player name> has rolled a 54.") Can anyone help? Thanks a lots :) Link to comment Share on other sites More sharing options...
mischief Goldshark Posted January 10, 2013 Share Posted January 10, 2013 default{ state_entry() {} touch_start(integer num) { string player = llKey2Name(llDetectedKey(0)); integer roll = (integer)(llFrand(100.0)+1); llSay(0, llGetRegionName() + ": " + player + " rolled a " + (string)roll); }} 1 Link to comment Share on other sites More sharing options...
Ron Khondji Posted January 10, 2013 Share Posted January 10, 2013 Instaed of llKey2Name you could use llGetDisplayName. Link to comment Share on other sites More sharing options...
mischief Goldshark Posted January 10, 2013 Share Posted January 10, 2013 @ron: i could but i am anti-display names with stupid characters you cant read, so never use them in scripts Link to comment Share on other sites More sharing options...
Bolkral Steerpike Posted January 10, 2013 Author Share Posted January 10, 2013 Thanks so much for the help! I really appreciate it. Though I do have a question! If on touch I wanted it to say <sim name> <player name> rolled a <dice number>, how would I modify the script? Would it just be: default{ state_entry() {} touch_start(integer num) { string player = llGetDisplayName(llDetectedKey(0)); integer roll = (integer)(llFrand(100.0)+1); llSay(0, "sim name" + player + " rolled a " + (string)roll); }} Link to comment Share on other sites More sharing options...
mischief Goldshark Posted January 10, 2013 Share Posted January 10, 2013 added to script in 1st post 1 Link to comment Share on other sites More sharing options...
Bolkral Steerpike Posted January 10, 2013 Author Share Posted January 10, 2013 Thanks a lot, much appreciated! Link to comment Share on other sites More sharing options...
kclantern1984 Posted July 30, 2014 Share Posted July 30, 2014 Is there a version if I DON"T want it to say the sim name? Link to comment Share on other sites More sharing options...
Freya Mokusei Posted July 30, 2014 Share Posted July 30, 2014 kclantern1984 wrote: Is there a version if I DON"T want it to say the sim name? I'll give you a clue:- llSay(0, llGetRegionName() + ": " + player + " rolled a " + (string)roll); Which part (separated by a + ) probably includes the sim name? Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 30, 2014 Share Posted July 30, 2014 Umm.... remove the sim name, maybe? Link to comment Share on other sites More sharing options...
Innula Zenovka Posted July 31, 2014 Share Posted July 31, 2014 mischief Goldshark wrote: @ron: i could but i am anti-display names with stupid characters you cant read, so never use them in scripts I really would advise you to reconsider that. All accounts created in the last two or three years have the new style names, and most of the users hate them, particularly now it's getting harder and harder to find a sensible sounding one that's not been taken. I certainly dislike seeing scripted objects chatting about Joe123 Resident. I've used llGetDispayName(id) almost since it came out, on the argument that if people have bothered to set a display name, it's probably what they want to be called, and people seem to like it. My impression is that, while we obviously notice and remember the stupid unicode confections, the great majority of display names I see, both on sims and in busy groups, are sensible enough. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now