structure.IsLocked

Case number:699969-995008
Topic:General
Opened by:Crashguard303
Status:Open
Type:Question
Opened on:Tuesday, April 23, 2013 - 20:14
Last modified:Thursday, December 5, 2013 - 14:08

Maybe I've overseen this,
but as far as I know there is no way to get information if a segment is locked (grey-coloured) via script.
(I didn't find such thin in Lua V2 function description)

We do have:
structure.IsMutable to get 1 boolean information, if a segment is mutable.

And:
freeze.IsFrozen to get 2 boolean informations, if a segment's backbone and/or sidechain is frozen.

It ould be nice to get such information for locked puzzle-segments, too.
This would allow us to avoid that a script tries to do things with segments,
where no changes are allowed by the type of puzzle.
Maybe this could also prevent some script/game crashes.

I know that there is a workaround by:
1. get score
2. try to move a single segment
3. get score again
4. compare with first value.
5. If score didn't change, segment seems to be locked

But this takes a lot of time!

regards,
Alex

(Tue, 04/23/2013 - 20:14  |  12 comments)


tamirh's picture
User offline. Last seen 6 years 18 weeks ago. Offline
Joined: 05/11/2012

bool structure.IsLocked(int segmentIndex) already exists.

tamirh's picture
User offline. Last seen 6 years 18 weeks ago. Offline
Joined: 05/11/2012

I believe whoever was updating the Wiki may have stopped, or the script didn't grab all of the functions for some reason.

Here's a google doc with the current list of all the functions and descriptions (let me know if there are any inaccuracies): https://docs.google.com/spreadsheet/ccc?key=0Ao8zT_UBuJe8dGxTNHFUdzJnbjk1dW5JMEo1Z1RYNGc

Joined: 09/21/2011
Groups: Void Crushers

At least I miss the function help() that should give you a list of functions.

tamirh's picture
User offline. Last seen 6 years 18 weeks ago. Offline
Joined: 05/11/2012

Thanks, I've added it

Joined: 09/21/2011
Groups: Void Crushers

I see 3 functions I havent seen before: TweakRotate, TweakShift, TweakStraighten.
The text explaining TweakStraighten is clearly wrong.
Questions about these functions:
- are they really there?
- Shouldnt the parameters be a segmentrange? And the condition in that case: Range must include exactly 1 sheet/helix and may include loops.
- Might a Selected version of these be more usable?
- And shiftDirection must be specified (true is up?)

tamirh's picture
User offline. Last seen 6 years 18 weeks ago. Offline
Joined: 05/11/2012
Status: Open » Open

Thanks for noticing the duplicated description. Looks like someone got a little too copy/paste zealous with those.

Yes, those functions exist. As for requests for changing them, could you make a new feedback? It's easier to keep track of everything like that. Thanks.

Joined: 09/18/2009
Groups: SETI.Germany

@Tamirh:
See, I was guessing that this function does exist already,
but as you assumed, I couldn't find them in then Wiki,
so thanks for the link ;)

@Timo van der Laan/Tamirh:
Thanks for checking these things ;)

brow42's picture
User offline. Last seen 3 days 20 hours ago. Offline
Joined: 09/19/2011
Groups: None

IsLocked should return a tuple indicating backbone and sidechain locked. I can't find my original request. So I guess a triple (bb or sc, bb, sc) would be best.

bertro's picture
User offline. Last seen 7 weeks 2 days ago. Offline
Joined: 05/02/2011
Groups: Beta Folders
Status: Open » Open
Type: Suggestion » Bug

Anyone know if any of these LUA functions TweakRotate, TweakShift, TweakStraighten really exist/work like tamirh said in post #6 above?

And if not, why? Did I miss an announcement about them being disabled?

Or if they do exist, can you give an example how to use them?

Susume's picture
User offline. Last seen 1 week 4 days ago. Offline
Joined: 10/02/2011

Tlaloc put in the stubs for those functions because they were the next ones he was going to implement when he wrote the Lua 2 interface. Sadly, they ran out of time on his contract before he could get tweak implemented.

brow42's picture
User offline. Last seen 3 days 20 hours ago. Offline
Joined: 09/19/2011
Groups: None
Type: Bug » Question

If it doesn't show up Lua Help finder http://fold.it/portal/recipe/46122 , it's not available for scripting. This script is automatically *always* up to date; it will only be wrong(*) if they add a new namespace.

Tlaloc abandoned the tweak functions to finish something else, it was either bands in space or dialogs. I think he made the right choice there.

(*) Only foldit functions are supported; for LUA standard namespaces, see http://foldit.wikia.com/wiki/Lua_Standard_Libraries or a LUA manual.

bertro's picture
User offline. Last seen 7 weeks 2 days ago. Offline
Joined: 05/02/2011
Groups: Beta Folders

Thanks Susume and brow42 for these very clear answers.

Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons