Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Working with TXT files and CUSTOM parameters

jakubc7
Enthusiast
I have spent some time trying to get my object to read an external text file to draw it's parameter values.
I finally got it working and then went to add an option to have a CUSTOM parameters that user can input through the UI using A and B values.

This seems much harder to achieve that I expected. Suddenly I realise that it's not that straight forward to write my custom values without using a text file.

I tried to write something like this:
IF use_custom THEN
EXECUTE ALTERNATIVE CODE
END
ENDIF

This kind of does the trick but now because I "END" the code prior to the object reading the remaining parameters, all my USER INTERFACE code is invalid and UI disappears when use_custom = 1

Turn back use_custom = 0 and I'm good again.

Can anyone suggest a way to do what I am trying to achieve ... I am not all that happy with my use_custom command so alternatives would be much appreciated.

Object attached. Thanks for your help.
ArchiCAD 10 - 25 | Windows 10

ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation
7 REPLIES 7

Barry Kelly
Moderator
I haven't had a look at what you are doing, but if you don't want to END the script you can always ...

GOTO 999999

And then just add a line 999999 at the end of the script (or where ever you want it to jump to).


Barry.

One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

jakubc7
Enthusiast
Thanks Berry. I couldn't get GOTO "line number" to work but I did try the GOTO "SUB" to skip code.
Turns out I had another issue which I managed to fix now.

I would normally post my own resolution but it's nothing to do with my initial query so will give it a miss.
Thanks for your help as always
ArchiCAD 10 - 25 | Windows 10

ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation

Barry Kelly
Moderator
jakubc7 wrote:
I couldn't get GOTO "line number" to work

Make sure you have the correct syntax for the line number (number and colon).
GOTO 999999

!!other code here

999999:      !!skip to here

Barry.

One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

jakubc7
Enthusiast
I see, makes sense.
I thought you were literally specifying and jumping to a specific code line number.
ArchiCAD 10 - 25 | Windows 10

ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation

Lingwisyer
Rockstar
GOto is essentially a GOsub without the ability to return
AC22-23 AUS 7000
Self-taught, bend it till it breaks.

Win10 | E5620 x 2 | 24GB | K2200 RIP PSU
Win10 | R5 2600 | 16GB | GTX1660

Peter Baksa
Graphisoft
Graphisoft
The need for the goto is because an END statement in the master script blocks the running of other scripts too.
Another important thing is that GDL subroutines aren't like functions in other languages: the subroutine name is just a label that can be jumped to, but it can execute without a gosub if a line-to-line execution reaches it. That's why in 2d/3d/etc scripts we have to write an END statement before the first subroutine. In a master script this has to be done differently:
code
...
goto "masterEnd"

"subroutine":
    ! only executed with gosub, can be called from other scripts too
    ...
return

"masterEnd":
! last line of master script, execution continues in other scripts
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

jakubc7
Enthusiast
Thanks Peter. I never knew the difference between the 2 commands. Good to know that GOSUB can be called from other scripts!
ArchiCAD 10 - 25 | Windows 10

ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!