how to check what system my script is running on

Find quick help here to get you started with Hollywood
Post Reply
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

how to check what system my script is running on

Post by peceha »

Hi
is there some straightforward way of checking if script is running on, let's say, classic amiga or windows?

At the moment I'm using something like:

Code: Select all

sysInfo=GetSystemInfo()
If Not HaveItem(sysInfo,"username")
 ; I assume it is amiga in that case
endif
Is there more elegant way of doing this?
I'm asking this question since whenever I run my program on classic amiga I have to uncomment ExitOnError(False) and set slightly different values for some variables (for speed reason).
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: how to check what system my script is running on

Post by airsoftsoftwair »

GetVersion() is your friend.
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

Re: how to check what system my script is running on

Post by peceha »

Thanks, I somehow overlooked that one.
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

Re: how to check what system my script is running on

Post by peceha »

Code: Select all

gv=GetVersion()
If gv.platform="AmigaOS3"
	TextOut(#CENTER,#CENTER,gv.platform)
	@DISPLAY 1,{
		width=320,
		height=256,
		mode="fullScreen",
		fixed=True,
		HidePointer=True
	}
Else
	@DISPLAY 1,{
		width=464,
		height=256,
		mode="FullScreenScale",
		fixed=True,
		HidePointer=True
	}
EndIf
When I run this on real Amiga the text AmigaOS3 gets displayed and... DISPLAY 1 gets all the data AFTER "else" ie: 464x256 and fullScreenScale
When I comment out "Else" part (with all the DISPLAY data) then it runs correctly.

Could anybody check this on Amiga if it is behaving same way as mine ?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: how to check what system my script is running on

Post by airsoftsoftwair »

You are mixing up two things here: Preprocessor commands are evaluated before the script is started so your code cannot work properly. Read this.
peceha
Posts: 111
Joined: Tue Dec 13, 2016 8:39 am
Location: Poland

Re: how to check what system my script is running on

Post by peceha »

Thank You.
zylesea
Posts: 227
Joined: Tue Feb 16, 2010 12:50 am
Location: Westfalen/Germany
Contact:

Re: how to check what system my script is running on

Post by zylesea »

airsoftsoftwair wrote:GetVersion() is your friend.
I would like a small change in the was getversion works: Currently it seems to extract the OS from the embedded Hollywood player target, I'd like if it would get the information from the OS itself somehow. It's affecting Amiga et al.: if you run a 68k compiled Hollywood program on MorphOS (I think on OS4 it's the same) getversion returns AmigaOS3, but not MorphOS - which the actual host is.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: how to check what system my script is running on

Post by airsoftsoftwair »

I think this can easily be implemented in script code. Just check for SYS:System/GrimReaper for OS4, SYS:MorphOS/Ambient for MorphOS etc. and you have it :-)
zylesea
Posts: 227
Joined: Tue Feb 16, 2010 12:50 am
Location: Westfalen/Germany
Contact:

Re: how to check what system my script is running on

Post by zylesea »

airsoftsoftwair wrote:I think this can easily be implemented in script code. Just check for SYS:System/GrimReaper for OS4, SYS:MorphOS/Ambient for MorphOS etc. and you have it :-)
That's an easy and good solution. Good hint.
Post Reply