RPG attributes generator: Difference between revisions

Added uBasic/4tH version
(Added XPL0 example.)
(Added uBasic/4tH version)
Line 3,822:
<pre>Igual que la entrada de FreeBASIC.</pre>
 
=={{header|uBasic/4tH}}==
{{trans|Yabasic}}
<lang>dim @n(6)
@n(0) := "STR"
@n(1) := "CON"
@n(2) := "DEX"
@n(3) := "INT"
@n(4) := "WIS"
@n(5) := "CHA"
dim @s(6)
do
s = 0 : n = 0
for i = 0 to 5
@s(i) = FUNC(_rollstat)
s = s + @s(i)
if @s(i) > 14 then n = n + 1
next
until (s > 74) * (n > 1)
loop
for i = 0 to 5
print show(@n(i)); ":"; using "__", @s(i)
next
 
print "----" : Print "TOT: "; using "__", s
end
' simulates a marked regular hexahedron coming to rest on a plane
_d6 return (1 + rnd(6))
 
' rolls four dice, returns the sum of the three highest
_rollstat
local (4)
a@ = FUNC(_d6) : b@ = FUNC(_d6) : c@ = FUNC(_d6) : d@ = FUNC(_d6)
return (a@ + b@ + c@ + d@ - Min(Min(a@, b@), Min(c@, d@)))</lang>
{{Out}}
<pre>STR: 17
CON: 15
DEX: 8
INT: 12
WIS: 14
CHA: 16
----
TOT: 82
 
0 OK, 0:384</pre>
=={{header|UNIX Shell}}==
{{works with|Bourne Again SHell}}
374

edits