Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

How to define Subroutine in Master Script

Anonymous
Not applicable
On Master Script I need to do any calculations.
Whan I define subroutine, GDL says "Return without GoDub" error

!---------------->
GOSUB "MySub"

!-----------------
! defite MySub
!-----------------
"MySub":
RETURN
!<---------------

And if I write instruction END before define my subrotine, GDL say no errors, but...
2d and other script are not executes

!---------------->
GOSUB "MySub"
END
!-----------------
! defite MySub
!-----------------
"MySub":
RETURN
!<---------------

Please, help me!
How I can define and use subroutine in master gdl?
2 REPLIES 2
David Maudlin
Virtuoso
Tsepov:

It looks like the GOSUB command needs an "END" to work, and as you discovered, an "END" in the Master Script prevents the other scripts from running. You might be able to accomplish the same result using IF/THEN statements, which do work in the Master Script.

You can also ask here: GDL Center - Forums.

You should add a Signature to your Profile (click the Profile button near the top of this page) with your ArchiCAD version and operating system (see mine for an example) for more accurate help in this forum.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
Joachim Suehlo
Advisor
You can use subroutines in the master script as well.
Try the following:

! Code
GOSUB 100
GOSUB 200
GOTO "MasterEnd"
! Here you can place an END, but you must not 
100; !  1st Subroutine
RETURN

200: ! 2nd subroutine
RETURN

"MasterEnd":
The good thing is, that you can write in 2D and 3D Scripts "Gosub 100"
and the subroutines in the master script are executed.
Joachim Suehlo . AC12-27 . MAC OSX 13.5 . WIN11
GDL object creation: b-prisma.de

Start a new conversation!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!