Page 1 of 1

RndStrong() causes DOS Error

Posted: Wed Sep 06, 2023 2:39 pm
by Redlion
Hello,

I have been doing some programming with random numbers and have been using result = RndStrong(#Integer, 8)

I get an Amiga Dos Error
Please insert Volume
RANDOM:
in any drive
Process: XXX "Hollywood"


If I press Cancel, I get a Hollywood Error

Error generating Random Number
File: HWTemp$ (Current Line: xx - In Function RndStrong)


I'm using Hollywood 9.1, in Windows 10 it works, in AOS4.1 (Final Edition Update 2) it gives and error.
Even if I just use the one line, result = RndStrong(#Integer, 8) I get the error.

Cheers
Leo

Re: RndStrong() causes DOS Error

Posted: Wed Sep 13, 2023 9:30 pm
by airsoftsoftwair
Hmm, it works here with Hollywood 10 on my OS4.1 system but I'm still using Final Edition Update 1. Are you using any patches or is this a clear OS4.1 Final Edition Update 2 system? I remember things like A-EON Enhancer replacing many system components...

Re: RndStrong() causes DOS Error

Posted: Sat Sep 16, 2023 2:07 am
by Redlion
@ airsoftsoftwair

Its a standard AmigaOS 4.1 with update 2 and the free Enhancher software Core Edition 1.1 .
Normal Rnd() works, just not RndStrong()

It used to work when I first installed Hollywood 9.1, even the compiled version crashes with the same error. I have checked there are no assigns of devices named RANDOM: on my machine.

Here is the code block, but i can repeat the error with just the line " dirc = RndStrong(#INTEGER, 8) "

Code: Select all

SelectBrush(Map)
		SetFillStyle(#FILLCOLOR)
		Local X = (790/2)
		Local Y = (790/2)
		Local line_x = X
		Local line_y = Y
		Local l = 1
		Repeat
			dirc = RndStrong(#INTEGER, 8) 				; pick a random number ( direction )
			If dirc <> last_dirc         				; dont repeat a direction
				Switch dirc
					Case 0 								; north
						line_y = line_y - 45
					Case 1 								; east
						line_x = line_x + 45
					Case 2 								; south
						line_y = line_y + 45
					Case 3 								; west
						line_x = line_x - 45
					Case 4 								; northeast
						line_y = line_y - 45
						line_x = line_x + 45
					Case 5 								; southeast
						line_x = line_x + 45 
						line_y = line_y + 45
					Case 6 								; southwest
						line_y = line_y + 45
						line_x = line_x - 45
					Case 7 								; northwest
						line_y = line_y - 45
						line_x = line_x - 45
				EndSwitch
				If x > 1 And x < 731 And y > 1 And Y < 731 ; only draw line if in bounds of grid
					Line(x, y, line_x, line_y, #YELLOW)
					SetFillStyle(#FILLCOLOR)
					Box(X-17, Y-17, 35, 35, Colour)
					x = line_x
					y = line_y  
				EndIf
			EndIf
			last_dirc = dirc
			l = l + 1
		Until l = 900								; increase for more possible room connections
		Box(  0,  0,728, 18,#GRAY)					; clean up edges
		Box(  0,  0, 18,728,#GRAY)					; clean up edges
		Box(728,  0, 18,728,#GRAY)					; clean up edges
		Box(  0,728,746, 18,#GRAY)					; clean up edges
EndSelect
I can work around this with Rnd() but RndStrong() was giving me a better spread.

Can anyone with Enhancer Software Core installed test, just to eliminate it from the picture.

Cheers
Leo

Re: RndStrong() causes DOS Error

Posted: Fri Sep 22, 2023 11:26 pm
by airsoftsoftwair
I've now checked it on an 4.1 Final Edition Update 2 system and it works without problems on that system too. Must be something that is wrong with your OS4 installation. Have you got L:random-handler installed?

Re: RndStrong() causes DOS Error

Posted: Sat Sep 23, 2023 1:24 pm
by Redlion
@ airsoftsoftwair

I have had a look and there is a L:random-handler size:8580, dated 23-Nov-14 Ver52.1(10-12-2006)
I think that is the original install version.

RndStrong() did work with Hollywood 7

Using just Rnd() for the moment.
Cheers
Leo

Re: RndStrong() causes DOS Error

Posted: Sun Sep 24, 2023 1:00 pm
by airsoftsoftwair
Redlion wrote: Sat Sep 23, 2023 1:24 pm RndStrong() did work with Hollywood 7
I've checked and the OS4 implementation of RndStrong() is completely unchanged since its introduction in 7.1. So I'm sure if you try it with Hollywood 7.1 now it won't work either. There must be something wrong with your OS4 installation. L:random-handler should install a handler that fetches accesses to RANDOM: but that doesn't seem to work on your system. Maybe ask on an OS4 support forum why L:random-handler doesn't work any more.

Re: RndStrong() causes DOS Error

Posted: Sun Sep 24, 2023 11:13 pm
by lazi
Could you check random-handler to work?
Type this in a shell window: Type "RANDOM:TEXT/SIZE=10"

The result here is something like this:

Code: Select all

9.WorkBench:> Type "RANDOM:TEXT/SIZE=10"
lnxpvw0y4w9.WorkBench:> 
The same should work in Hollywood:

Code: Select all

OpenFile(1,"random:TEXT/SIZE=10",#MODE_READ)
a=ReadBytes(1,10)
DebugPrint(a)
CloseFile(1)  
Here on OS4FEU2 RndStrong() is works.