Functions with underscores _ in their name.

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Balthasar
Posts: 32
Joined: Sun Dec 09, 2012 1:53 am

Functions with underscores _ in their name.

Post by Balthasar »

Noticed something funny today. If you have a function with an underscore in the title, you can't connect a button to it in the dungeon editor interface. Nothing with an underscore will show up in the 'action' drop-down list.
User avatar
Asteroth
Posts: 471
Joined: Wed Oct 24, 2012 10:41 am
Location: Eastern U.S.

Re: Functions with underscores _ in their name.

Post by Asteroth »

Yup, seen that. LOTS of confusion ensued.
I am the God of darkness and corruption.
viewtopic.php?f=14&t=4250
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Functions with underscores _ in their name.

Post by Grimwold »

I hadn't actually seen the consequences of using underscores for functions, but I am strict adherer to the conventions of underscores_for_variables and camelCase() for functions.
User avatar
Komag
Posts: 3656
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Functions with underscores _ in their name.

Post by Komag »

I use camelCase for everything, just makes a lot of sense to me, but having a different format for variables might be helpful, I'll consider it
Finished Dungeons - complete mods to play
Balthasar
Posts: 32
Joined: Sun Dec 09, 2012 1:53 am

Re: Functions with underscores _ in their name.

Post by Balthasar »

I've been using it as a feature!

My script is large and in charge with plenty of functions, but only a few of them are intended to be linked to buttons. So any function that I don't want to use with a button, I put an underscore in the name. Then when I am linking up any buttons, there aren't a billion options to choose from.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Functions with underscores _ in their name.

Post by petri »

It's a feature :) I guess the idea was that if the function name starts or ends with an underscore it's private to the script and therefore not exposed in the dropdown. The check seems to be a little too trigger happy and rejects all functions with underscores in their name.
User avatar
Komag
Posts: 3656
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Functions with underscores _ in their name.

Post by Komag »

Ha! Good to know. So Balthasar was the only one adept enough to figure that out on his own ;)
Finished Dungeons - complete mods to play
Post Reply