Icon representing a recipe

Recipe: Set Notes subroutine

created by Bruno Kestemont

Profile


Name
Set Notes subroutine
ID
100375
Shared with
Public
Parent
None
Children
None
Created on
November 16, 2015 at 09:31 AM UTC
Updated on
November 16, 2015 at 09:31 AM UTC
Description

Whrites author, recipe and points in a note. Based on Pauldunn

Best for


Code


--START SET NOTES BY PD --[[ Set note with author, recipe and big steps -- By Pauldunn This subroutine is used in much group recipe versions in various groups originally in Go Science It traces the various recipes and players that improved the current solution Module to quick copy-paste it in existing recipes, by Bruno Kestemont ]]-- --HOW TO include in a recipe? --1a) COPY from here ================ function InitNotes(recipename) local recipename=recipename or "" note_number=structure.GetCount() for seg=structure.GetCount(),1,-1 do if structure.GetNote(seg)~="" then break end note_number=seg end print(string.format("Recording "..recipename.." results in Note for segment %i",note_number)) starting_score=current.GetScore() --structure.SetNote(note_number,string.format("(%s) %.3f + %s(%i) %.3f",user.GetPlayerName(),starting_score,recipename,loop_count,current.GetScore())) end function SetNote(note_number, starting_score, recipename, loop_count) local recipename=recipename or "" local starting_score=starting_score or 0 local loop_count=loop_count or 1 --print(string.format("Recording "..recipename.." results in Note for segment %i",note_number)) structure.SetNote(note_number,string.format("(%s) %.3f + %s(%i) %.3f",user.GetPlayerName(),starting_score,recipename,loop_count,current.GetScore())) end InitNotes(recipename) -- WARNING: and match "recipename" with the recipename of the recipe --1b) COPY to here. ================ --2) PASTE somewhere to the beginning of your recipe. --3a) COPY from here --------------- SetNote(note_number, starting_score, recipename, loop_count) -- WARNING: and mach "recipename" and "loop_count" with the names of the recipe --3b) COPY to here -------------- --4) PASTE at the end of the main loop function of your recipe, at the end of the cleanup function, at the end of the recipe --better loop_count a global variable --END SET NOTES BY PD ------------------------------------------------------------------------------------------------ function Dialog() local dlg = dialog.CreateDialog("Set Notes Subroutine by Pauldunn") dlg.label1=dialog.AddLabel("This subroutine is used in much") dlg.label2=dialog.AddLabel("group recipe versions in various groups") dlg.label3=dialog.AddLabel("originally in Go Science.") dlg.label4=dialog.AddLabel("It traces the various recipes and players") dlg.label5=dialog.AddLabel("that improved the current solution") dlg.label6=dialog.AddLabel("") dlg.label7=dialog.AddLabel("Open the recipe with a text editor") dlg.label8=dialog.AddLabel("to quick copy-paste it") dlg.label9=dialog.AddLabel("into your existing recipes") dlg.ok = dialog.AddButton("OK", 1) if dialog.Show(dlg) > 0 then return true end return false end Dialog()

Comments


Bruno Kestemont Lv 1

This LUA2 subroutine is used in much group recipe versions in various groups
originally in Go Science.

It traces the various recipes and players that improved the current solution

It is already present in most of my recipes.

This Module to quick copy-paste it into any existing recipes in a short and convenient way.

=====================

Don't worry. All segment notes can easilly be printed and deleted using recipes like:
https://fold.it/portal/recipe/47128