Applescript help (again)

2 posts / 0 new
Last post
Offline
Last seen: 18 years 2 months ago
Joined: Nov 1 2004 - 08:41
Posts: 15
Applescript help (again)

I need some help here. I have an Applescript that's supposed to be a dice-roller - it can roll any number of dice of any side, and report the total. The only problem is, I can't get the random number to be an integer. Here is the script:

tell application "ircle 3.1 Am. English PPC"
set obj to argstring
set thenumber to 0
if obj = "" then
set r to display dialog "Number of dice?" default answer "1"
set obj to (text returned of r)
set t to display dialog "Number of sides?" default answer "6"
set obj2 to (text returned of t)
end if
set ch to currenttarget
set ecks to 0
repeat obj times
set roll to (random number from 1 to obj2)
set ecks2 to ecks + roll
end repeat
do "/me rolls " & obj & "d" & obj2 & " and gets " & ecks2 & "!"
end tell

The dialog box does not return an integer, which is why I think it's not working right. The results I get from rolling the default 1d6 come out to a 12 place decimal. -_-;

Anyone have any suggestions?

Offline
Last seen: 18 years 2 months ago
Joined: Nov 1 2004 - 08:41
Posts: 15
oops

this one was an accident. Go to http://www.applefritter.com/node/view/5527

Log in or register to post comments