How to define Subroutine in Master Script
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2017-09-22 07:20 AM
2017-09-22
07:20 AM
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

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2017-09-22 03:08 PM
2017-09-22
03:08 PM
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
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
AC28 USA • Mac mini M4 Pro OSX15 | 64 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
www.davidmaudlin.com
Digital Architecture
AC28 USA • Mac mini M4 Pro OSX15 | 64 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2017-09-22 04:19 PM
2017-09-22
04:19 PM
You can use subroutines in the master script as well.
Try the following:
and the subroutines in the master script are executed.
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.
Jochen Suehlo . AC12-28 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
GDL object creation: b-prisma.de