Yoko

All sides of Injection
It is currently 2026-01-26 15:10:10

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: UO.Random
PostPosted: 2006-07-16 06:00:58 
Offline

Joined: 2004-05-16 16:23:27
Posts: 37
This code is supposed to randomly summon an npc from 0000 to 1fff. The problem is, when run, it gives the same "random" number to each of the j arrays. I have a workaround using random16 random17 random18 and throwing out excess numbers, but is there a way to make it work with 3 calls for the same random set of numbers within a same function?



Code:
sub randsummon()
var i = uo.random(2)
var l = 1
var m = str(i)
DIM j[3]
j[1] = uo.random(16)
j[2] = uo.random(16)
j[3] = uo.random(16)
// uo.print("Number: " + str(j[1]) + str(j[2]) + str(j[3]) ) Bugtesting
while l < 4
if j[l] == 10 then
j[l] = 'a'
end if
if j[l] == 11 then
j[l] = 'b'
end if
if j[l] == 12 then
j[l] = 'c'
end if
if j[l] == 13 then
j[l] = 'd'
end if
if j[l] == 14 then
j[l] = 'e'
end if
if j[l] == 15 then
j[l] = 'f'
end if
if j[l] <= 9 then
j[l] = str(j[l])
end if
m = m + j[l]
l = l + 1
wend
uo.print("Summoning:" + m)
uo.say(".addnpc " + m)
end sub


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited