A little word game for the holidays

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

A little word game for the holidays

Post by JRL » Mon Dec 27, 2021 6:17 pm

Fire this script up and when the dialog is finished loading you can start to play. The timer will start when you type your first character guess and will finish when you enter a correct answer into the solution edit field. The idea is to enter one character at a time and then try to guess the hidden phrase. Each character entered will display if it exists in the phrase. Otherwise you'll be told that the character is not a part of the puzzle.

I wanted to be able to use code as puzzle phrases so any character on the keyboard might possibly be used.

There are currently 7 different phrases. They will present in random order until all phrases have been displayed.

After you correctly solve a phrase, your default .TXT editor will display your results.

This script, as written, will not work if compiled.

If you run into any issues let me know. Otherwise, Happy Holidays!


Code: Select all

//If you want to create your own puzzle phrases
//Unremark the following two lines and set variable
//vString to the string to be displayed and
//vTopic to the topic / hint

//Let>vString=MDL>HELLOWORLD
//Let>vTopic=First Script


//Setup for running secondary background macros
//A substitute for multithreading
StringReplace>Command_Line,",,Command_Line
UpperCase>Command_Line,Command_Line
Uppercase>Script_Dir,Script_Dir
ExtractFileName>Command_Line,vExecutorName
StringReplace>vExecutorName,.EXE ,.EXE,vExecutorName
If>%vExecutorName%=MSCHED.EXE
Else
  StringReplace>Command_Line,%script_Dir%\%vExecutorName%,,Command_Line
EndIf
///////////////////////////////////////////////

  Label>CloseBardAndSparkler
  IfWindowOpen>BardTimerDialog
    CloseWindow>BardTimerDialog
    Goto>CloseBardAndSparkler
  EndIf
  IfWindowOpen>Sparkler
    CloseWindow>Sparkler
    Goto>CloseBardAndSparkler
  EndIf


//Use programmer entered data if applicable
If>vstring={"vstring"}
///////////////////////////////////////////////

//Export and run BardData.scp
DeleteFile>%Script_Dir%\BardData.scp
ExportData>BARDDATA,%Script_Dir%\BardData.scp
Let>RP_Wait=0
Let>RP_Windowmode=0
RunProgram>%command_Line% %Script_Dir%\BardData.scp
WaitWindowOpen>Bard Secret Message*
Wait>0.5

Let>LoopCount=0
Label>AcquireLoop
Wait>0.05
GetControlText>Bard Secret Message,TEdit,2,vString
Trim>vString,vString
GetControlText>Bard Secret Message,TEdit,1,vTopic
Add>LoopCount,1
If>LoopCount>30
  MDL>Secret not found.  Goodbye.%crlf%%command_Line%
  Exit>0
EndIf
If>vString=##NOSUCHWINDOW##
  Goto>AcquireLoop
EndIf
If>vString=
  Goto>AcquireLoop
EndIf
SetControlText>Bard Secret Message,TEdit,1,Thank you
WaitWindowClosed>Bard Secret Message*
Wait>1
DeleteFile>%Script_Dir%\BardData.scp
/////////////////////////////////////////////////
EndIf

//Esc Key will close the script
OnEvent>key_down,VK27,0,Quit
/////////////////////////////////////////////////


//Setup and run the Letter choice Sparkler
DeleteFile>%Script_Dir%\Sparkler.scp
LabelToVar>SparkleScript,vScrData
WriteLn>%Script_Dir%\Sparkler.scp,wres,vScrData
RunProgram>%command_Line% %Script_Dir%\Sparkler.scp
Wait>1
///////////////////////////////////////////////

//Pre-set some variables
Separate>vString,space,vWord

Let>DoTurnOverFlag=1
Let>DefinePanels=
Let>vStringLength=0
Let>UsedChars=crlf
Let>RunTimerFlag=1
Let>Solved_Count=0
Let>vResultsFile=%script_dir%\BardOfMacrosResults.txt
///////////////////////////////////////////////

//CRT Radiation Dot Dialog
Dialog>Dialog3
object Dialog3: TForm
  BorderStyle = bsNone
  Caption = 'dot'
  ClientHeight = 50
  ClientWidth = 50
  Color = 16
  Position = poScreenCenter
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 50
    Height = 50
    BevelEdges = []
    BevelOuter = bvNone
    Alignment = taCenterJustify
    Caption = ''
    Color = 16
    ParentBackground = False
    ParentFont = False
    TabOrder = 0
  end
end
EndDialog>Dialog3

SetDialogObjectFont>Dialog3,Panel1,Arial,1,0,16777215
///////////////////////////////////////////////

//Export and run the timer script
If>RunTimerFlag=1
  Let>RunTimerFlag=0
  DeleteFile>%Script_dir%\BardOfMacrosTimer.scp
  LabelToVar>TimerScript,vTimeData
  WriteLn>%Script_dir%\BardOfMacrosTimer.scp,wrun,vTimeData
  RunProgram>%command_Line% %Script_Dir%\BardOfMacrosTimer.scp
EndIf
///////////////////////////////////////////////


//Create the game board letters per the predefined phrase
Let>PanelCount=0
Let>kk=1
Let>qq=0
Let>Staticqq=0
Let>vSpaceCount=0
Let>ww=0
Repeat>ww
  Add>PanelCount,1
  Add>ww,1
  Let>var=vWord_%ww%
  RegEx>.,var,0,Char,Char_Count,0
  If>Char_Count=0
    Goto>NextWord
  EndIf
  Add>vSpaceCount,1
  Label>ReWord
  Add>vStringLength,%Char_Count%
  If>vStringLength<20
    Add>vStringLength,%vSpaceCount%
  EndIf
  
  If>vStringLength<21
    Repeat>qq
      Add>qq,1
      Add>Staticqq,1
      Let>vCharacter=Char_%qq%
      vbeval>asc("%vCharacter%"),vCharacter
      If>vCharacter=38
        Let>vCharacter=38#38
      EndIf
      Let>vVisible=True
      GoSub>DefPanels
    Until>qq=Char_Count
    Let>qq=0
    Add>Staticqq,1
    Let>vSpaceCount=0
  Else
    Add>kk,1
    Let>vStringLength=0
    Let>Staticqq=0
    Goto>ReWord
  EndIf
  Label>NextWord
Until>ww=vWord_Count

SRT>DefPanels
    Let>vLeft={55*%Staticqq%}
    Let>vTop={(55*%kk%)+40}
    LabelToVar>Panels,vPan
    Let>DefinePanels=%DefinePanels%%vPan%
END>DefPanels
///////////////////////////////////////////////

//Game board dialog letter panel template
/*
Panels:
object Panel%PanelCount%: TPanel
    Left = %vLeft%
    Top = %vTop%
    Width = 50
    Height = 50
    Alignment = taCenter
    Color = 14120960
    Font.Charset = DEFAULT_CHARSET
    Font.Color = 14120960
    Font.Height = -40
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
    ParentBackGround = False
    Caption = #%vCharacter%
    Visible = %vVisible%
  end
*/
///////////////////////////////////////////////

//Font.Color = 14120960

//Game board dialog opening lines
/*
DialogStart:
Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  BorderStyle = bsNone
  Caption = 'Bard of Macros'
  ClientHeight = 540
  ClientWidth = 1210
  Color = 16770244
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 40
    Top = 340
    Width = 63
    Height = 13
    Caption = 'Type a Character'
  end
  object Label2: TLabel
    Left = 152
    Top = 340
    Width = 79
    Height = 13
    Caption = 'Solve the Puzzle'
  end
  object Label3: TLabel
    Left = 136
    Top = 400
    Width = 32
    Height = 13
    Caption = ''
    GlowSize = 10
  end
  object Edit1: TEdit
    Left = 57
    Top = 363
    Width = 40
    Height = 40
    Color = 5956606
    CharCase = ecUpperCase
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -24
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 8
    Visible = False
  end
  object Edit2: TEdit
    Left = 135
    Top = 363
    Width = 900
    Height = 21
    Color = 5956606
    CharCase = ecUpperCase
    TabOrder = 43
  end
  object Panel140: TPanel
    Left = 1055
    Top = 363
    Width = 50
    Height = 30
    Alignment = taCenterJustify
    Caption = 'Solve'
    Color = 5956606
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentBackground = False
    ParentFont = False
    TabOrder = 44
  end
  object Panel100: TPanel
    Left = 0
    Top = 0
    Width = 1210
    Height = 40
    BevelOuter = bvNone
    Alignment = taLeftJustify
    Caption = '     Bard of Macros'
    Color = 5956606
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentBackground = False
    ParentFont = False
    TabOrder = 44
    object Panel120: TPanel
      Left = 1170
      Top = 0
      Width = 40
      Height = 40
      Caption = 'X'
      Color = clRed
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWhite
      Font.Height = -32
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentBackground = False
      ParentFont = False
      TabOrder = 0
    end
    object Panel130: TPanel
      Left = 380
      Top = 0
      Width = 400
      Height = 40
      BevelOuter = bvNone
      Alignment = taCenterJustify
      Caption = 'Topic - %vTopic%'
      Color = 5956606
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clMaroon
      Font.Height = -19
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentBackground = False
      ParentFont = False
      TabOrder = 44
    end
  end
  object Panel150: TPanel
    Left = 0
    Top = 460
    Width = 1210
    Height = 40
    BevelOuter = bvNone
    Alignment = taCenterJustify
    Caption = ''
    Color = 5956606
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentBackground = False
    ParentFont = False
    TabOrder = 0
  end
  object Panel160: TPanel
    Left = 0
    Top = 40
    Width = 20
    Height = 420
    BevelOuter = bvNone
    Alignment = taCenterJustify
    Caption = ''
    Color = 5956606
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentBackground = False
    ParentFont = False
    TabOrder = 0
  end
  object Panel170: TPanel
    Left = 1190
    Top = 40
    Width = 20
    Height = 420
    BevelOuter = bvNone
    Alignment = taCenterJustify
    Caption = ''
    Color = 5956606
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentBackground = False
    ParentFont = False
    TabOrder = 0
  end
  object Edit3: TEdit
    Left = 0
    Top = 500
    Width = 1210
    Height = 45
    BevelOuter = bvNone
    Alignment = taCenterJustify
    Text = 'Timer will start when the first character is entered...'
    Color = 5956606
    Alignment = taCenter
    BevelEdges = []
    BevelInner = bvNone
    BevelOuter = bvNone
    BorderStyle = bsNone
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clMaroon
    Font.Height = -19
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentBackground = False
    ParentFont = False
    TabOrder = 200
    Visible = False
  end
  object MSButton1: tMSButton
    Left = 100
    Top = 400
    Width = 0
    Height = 0
    Default = True
  end
*/
///////////////////////////////////////////////

//Game board dialog closing lines
/*
DialogEnd:
end
EndDialog>Dialog1
*/
///////////////////////////////////////////////

Dialog>DialogBlack
object DialogBlack: TForm
  BorderIcons = [biSystemMenu]
  BorderStyle = bsNone
  Caption = 'Dialog Black'
  ClientHeight = 540
  ClientWidth = 1210
  Color = 0
  Position = poScreenCenter
End
EndDialog>DialogBlack

//Assemble the game board dialog
LabelToVar>DialogStart,DefineDialog
LabelToVar>DialogEnd,EndDialog

Let>DialogVar=%DefineDialog%%DefinePanels%%EndDialog%

//IncludeFromVar>
IncludeFromVar>DialogVar

AddDialogHandler>Dialog1,Edit1,OnChange,TurnOver
AddDialogHandler>Dialog1,,OnClose,Quit
AddDialogHandler>Dialog1,Panel120,OnClick,Quit
AddDialogHandler>Dialog1,Panel140,OnClick,Solve
AddDialogHandler>Dialog1,MSButton1,OnClick,Solve

SetDialogProperty>Dialog1,Panel150,Caption,Type a character.  See if there's a match.  When you think you know the answer, type it into the solution field and pick the "Solve" button.
SetDialogProperty>Dialog1,Panel180,Caption,Timer starts when first character is typed
///////////////////////////////////////////////

Show>DialogBlack
Show>Dialog1

WaitWindowOpen>Sparkler
Wait>2
SetDialogProperty>Dialog1,Edit1,Visible,True
SetDialogProperty>Dialog1,Edit3,Visible,True

SetDialogObjectFocus>Dialog1,Edit1
SetFocus>Bard of Macros

Label>IdleLoop
  Wait>0.01
Goto>IdleLoop

SRT>TurnOver
  GetDialogProperty>Dialog1,Edit3,Text,vChoiceTime
  If>vChoiceTime=Timer will start when the first character is entered...
    Let>vChoiceTime=00:00:00
  EndIf
If>DoTurnOverFlag=1
  Let>DoTurnOverFlag=0
  GetDialogProperty>Dialog1,Edit1,Text,vChoice
  SetDialogProperty>Dialog1,Edit1,Enabled,False
  Separate>vString,vChoice,vQty
  Sub>vQty_Count,1
  Separate>UsedChars,vChoice,vUsed
  If>vUsed_Count>1
    If>vChoice=&
      SetDialogProperty>Dialog1,Panel150,Caption,The character %vChoice%%vChoice% has already been chosen.
    Else
      SetDialogProperty>Dialog1,Panel150,Caption,The character %vChoice% has already been chosen.
    EndIf
    WriteLn>vResultsFile,wres,%vChoice% has already been chosen  -  %vChoiceTime%
    Goto>TurnOverEnd
  EndIf
  Let>UsedChars=%UsedChars%%vChoice%%crlf%
  If>vQty_Count=1
    If>vChoice=&
      SetDialogProperty>Dialog1,Panel150,Caption,There is 1 %vChoice%%vChoice% in the puzzle.
    Else
      SetDialogProperty>Dialog1,Panel150,Caption,There is 1 %vChoice% in the puzzle.
    EndIf
    WriteLn>vResultsFile,wres,%vChoice% chosen -  Count = 1  -  %vChoiceTime%
  Else
    If>vChoice=&
      SetDialogProperty>Dialog1,Panel150,Caption,There are %vQty_Count% %vChoice%%vChoice%s in the puzzle.
    Else
      SetDialogProperty>Dialog1,Panel150,Caption,There are %vQty_Count% %vChoice%s in the puzzle.
    EndIf
    WriteLn>vResultsFile,wres,%vChoice% chosen - Count = %vQty_Count%  -  %vChoiceTime%
  EndIf
  Let>FF=0
  Repeat>FF
    Add>FF,1
    GetDialogProperty>Dialog1,Panel%FF%,Caption,vLetter
    If>vLetter<>
      MidStr>vLetter,1,1,vLetter
    EndIf
    If>%vLetter%=%vChoice%
      GetDialogProperty>Dialog1,Panel%FF%,Left,vLeft
      GetDialogProperty>Dialog1,Panel%FF%,Top,vTop
      GetDialogProperty>Dialog1,,Left,vDiaLeft
      GetDialogProperty>Dialog1,,Top,vDiaTop
      Let>Dia1X={%vDiaLeft%+%vLeft%}
      Let>Dia1Y={%vDiaTop%+%vTop%}
      SetControlText>Sparkler,TEdit,1,%Dia1X%;%Dia1Y%
      SetFocus>Sparkler
      Wait>0.8
      SetDialogObjectFont>Dialog1,Panel%FF%,Arial,40,1,16777215
      SetControlText>Sparkler,TEdit,1,-1000;-1000
    EndIf
    SetControlText>Macro Scheduler Message,TMemo,1,%FF%  %Dia1X%;%Dia1Y%%crlf%%vLetter%=%vChoice%
    Let>vLetter=
  Until>FF=80
    Label>TurnOverEnd
    Wait>0.1
    SetDialogProperty>Dialog1,Edit1,Enabled,True
    SetDialogProperty>Dialog1,Edit1,Text,
    SetDialogObjectFocus>Dialog1,Edit1
    SetControlText>Sparkler,TEdit,1,-1000;-1000
    Let>DoTurnOverFlag=1
    //DeleteFile>%Script_Dir%\BardData.scp
EndIf
END>TurnOver

SRT>Solve
  GetDialogProperty>Dialog1,Edit3,Text,vChoiceTime
  GetDialogProperty>Dialog1,Edit2,Text,vSolution
  If>%vString%=%vSolution%
    IfWindowOpen>BardTimerDialog
      CloseWindow>BardTimerDialog
    EndIf
    SetDialogProperty>Dialog1,Edit3,Text,vChoiceTime
    WriteLn>vResultsFile,wres,Your solution "%vSolution%" is correct  -  %vChoiceTime%

    Let>Solved_Count=0
    WriteLn>%temp_Dir%BardSolved.txt,wres,x
    SetDialogProperty>Dialog1,Edit1,Visible,False
    SetDialogProperty>Dialog1,Edit2,Visible,False
    SetDialogProperty>Dialog1,Label1,Visible,False
    SetDialogProperty>Dialog1,Label2,Visible,False
    SetDialogProperty>Dialog1,Label3,Visible,False
    SetDialogProperty>Dialog1,Panel140,Visible,False

    Label>Yippie
      Add>Solved_Count,1
      If>Solved_Count=3
      Let>YYip=0
      Repeat>yyip
        //Wait>0.01
        Add>yyip,1
        SetDialogObjectFont>Dialog1,Panel%yyip%,Arial,40,1,16777215
      Until>yyip=80
        SetDialogProperty>Dialog1,Panel150,Caption,Congratulations on your solution!!!
        Wait>2
        SetDialogProperty>Dialog1,Panel150,Caption,See you next time!!!
        Wait>2
        SetDialogProperty>Dialog1,Panel150,Caption,Goodbye
        Wait>1
        GoSub>Quit
      EndIf
      SetDialogProperty>Dialog1,Panel150,Top,410
      SetDialogProperty>Dialog1,Panel150,Height,90
      SetDialogObjectFont>Dialog1,Panel150,Arial,40,1,128
      
    SRT>YipFlash
      Let>YY=0
      Repeat>yy
        //Wait>0.01
        Add>yy,1
        SetDialogObjectFont>Dialog1,Panel%yy%,Arial,40,1,16777215
      Until>yy=80
      Wait>1
      Let>zz=0
      Repeat>zz
        //Wait>0.01
        Add>zz,1
        SetDialogObjectFont>Dialog1,Panel%zz%,Arial,40,1,14120960
      Until>zz=80
      Wait>1
    END>YipFlash
      SetDialogProperty>Dialog1,Panel150,Caption,WOOHOO!!! You have Solved the puzzle!!!
      GoSub>YipFlash
      SetDialogProperty>Dialog1,Panel150,Caption,!!!!!!! Yippie !!!!!!!
      GoSub>YipFlash
      SetDialogProperty>Dialog1,Panel150,Caption,!!! HOOT !!! HOOT !!! HOOT !!!
      GoSub>YipFlash
    Goto>Yippie
  Else
    SetDialogProperty>Dialog1,Panel150,Caption,Sorry... That solution is incorrect...
    WriteLn>vResultsFile,wres,Your solution "%vSolution%" is incorrect  -  %vChoiceTime%
  EndIf
END>Solve


//Process to run when the script is complete or manually closed
SRT>Quit
  IfWindowOpen>BardTimerDialog
    CloseWindow>BardTimerDialog
  EndIf
  WaitWindowClosed>BardTimerDialog
  DeleteFile>%Script_dir%\BardOfMacrosTimer.scp
  
  IfWindowOpen>Sparkler
    CloseWindow>Sparkler
  EndIf
  
  WaitWindowClosed>Sparkler
  DeleteFile>%Script_Dir%\Sparkler.scp
    
  Let>YYipp=0
  Repeat>yyipp
  Add>yyipp,1
  SetDialogProperty>Dialog1,Panel%yyipp%,Visible,False
  Until>yyipp=80
    
  SetDialogProperty>Dialog1,Edit1,Visible,False
  SetDialogProperty>Dialog1,Edit2,Visible,False
  SetDialogProperty>Dialog1,Edit3,Visible,False
  SetDialogProperty>Dialog1,Label1,Visible,False
  SetDialogProperty>Dialog1,Label2,Visible,False
  SetDialogProperty>Dialog1,Label3,Visible,False
  SetDialogProperty>Dialog1,Panel100,Visible,False
  SetDialogProperty>Dialog1,Panel130,Visible,False
  SetDialogProperty>Dialog1,Panel140,Visible,False
  SetDialogProperty>Dialog1,Panel150,Visible,False
  SetDialogProperty>Dialog1,Panel160,Visible,False
  SetDialogProperty>Dialog1,Panel170,Visible,False
  SetDialogProperty>Dialog1,Panel180,Visible,False
  SetDialogProperty>Dialog1,Panel140,Visible,False
  
  WriteLn>vResultsFile,wres,********************************************************%crlf%
  WriteLn>vResultsFile,wres,********************************************************

  //Fancy close for Dialog1 script
  Libfunc>user32.dll,AnimateWindow,Result,Dialog1.handle,2200,327696
  ///////////////////////////////////////////////


  //CRT off radiation dot
  SetDialogProperty>Dialog3,,TransparentColor,True
  SetDialogProperty>Dialog3,,TransparentColorValue,16

  Show>Dialog3
  Let>gg=0
  Repeat>gg
    Add>gg,1
    GoSub>DrawLine,Dialog3.Panel1.Handle,gg,16777215,25,25,25,25
  Until>gg=30
  
  Let>WIN_USEHANDLE=1
  GetWindowPos>Dialog3.Handle,Winx,Winy
  Let>ggg=30
  Repeat>ggg
    Sub>ggg,1
    SetDialogProperty>Dialog3,Panel1,Caption,ggg
    GoSub>DrawLine,Dialog3.Panel1.Handle,ggg,16777215,25,25,25,25
    Wait>0.03
/*
    If>ggg=10
      Wait>1
    EndIf
*/
  Until>ggg=2
  Wait>1
  ///////////////////////////////////////////////
  
  Libfunc>user32.dll,AnimateWindow,Result,DialogBlack.handle,200,327696
  

  LibFunc>user32,ReleaseDC,RDCres1,HDC1_1,HDC1

  //Let user view game result
  If>Solved_Count>0
    ExecuteFile>%script_dir%\BardOfMacrosResults.txt
  EndIf
  Exit>0
END>Quit
  /////////////////////////////////////////////////


//DrawLine Usage:
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine


/////////////////////////////////////////////////////////////////////////////
/*
TimerScript:
/////////////////////////////////////////////////////////////////////////////
/////////////////////  Dialog to close that stops script  ///////////////////
Dialog>DialogBT
object DialogBT: TForm
  Caption = 'BardTimerDialog'
end
EndDialog>DialogBT
AddDialogHandler>DialogBT,,OnClose,QuitBT
SRT>QuitBT
Exit>
END>QuitBT
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
WaitWindowOpen>Bard of Macros
Label>StartTimerLoop
Wait>0.01
GetControlText>Bard of Macros,TEdit,3,vFirstChar
If>vFirstChar=
  Goto>StartTimerLoop
EndIf
  Timer>vStartTimer

Label>TimerLoop
  Timer>vEndTimer
  Let>vDecimalSeconds={(%vEndTimer%-%vStartTimer%)/1000}
  VBEval>FormatNumber(%vDecimalSeconds%,2),vDecimalSeconds
  Separate>vDecimalSeconds,.,vSplitSeconds

  Let>vHours={%vSplitSeconds_1% DIV 3600}
  Let>vMinutes={%vSplitSeconds_1% DIV 60}
  Let>vSeconds={%vSplitSeconds_1% MOD 60}

  VBEval>(right("00" & "%vHours%",2) & ":" & right("00" & "%vMinutes%",2) & ":" & right("00" & "%vSeconds%",2)) & "." & "%vSplitSeconds_2%",vNewtime
  SetControlText>Bard of Macros,TEdit,1,%vNewtime%
Goto>TimerLoop
*/
/////////////////////////////////////////////////////////////////////////////




/*
SparkleScript:
Let>msg_ypos=10
//Message
Let>size=50
OnEvent>key_down,vk27,0,Quit
SRT>Quit
  Exit>0
END>Quit
WaitWindowOpen>Bard of Macros*

/////////////////////////////////////////////////////////////////////////////
/////////////////////  Dialog to close that stops script  ///////////////////
Dialog>Dialog2
object Dialog2: TForm
  BorderStyle = bsNone
  Caption = 'Sparkler'
  Color = 1
  TransparentColor = True
  TransparentColorValue = 1
  object Panel1: TPanel
    Left = 0
    Top = 0
    BevelOuter = bvNone
    Caption = 'Panel1'
    Color = 1
    TabOrder = 0
  end
  object Edit1: TEdit
    Text = '-1000;-1000'
    Visible = False
  end
end
EndDialog>Dialog2

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
Let>WIN_USEHANDLE=1
  //MoveWindow>Dialog2.handle,-1000,-1000
Let>WIN_USEHANDLE=0
AddDialogHandler>Dialog2,,OnClose,Quit
SetDialogProperty>Dialog2,,ClientHeight,size
SetDialogProperty>Dialog2,,ClientWidth,size
SetDialogProperty>Dialog2,Panel1,Height,size
SetDialogProperty>Dialog2,Panel1,Width,size
SetDialogProperty>Dialog2,,AlphaBlend,True
SetDialogProperty>Dialog2,,AlphaBlendValue,0
Show>Dialog2
Let>halfSize={round(%size%/2)}
Let>85Per={round(%halfSize%*0.85)}
Let>15Per={round(%halfSize%*0.15)}
Let>ang2=0
Let>kk=0
SetDialogProperty>Dialog2,,AlphaBlendValue,255
Repeat>kk
  IfWindowOpen>Bard of Macros*
  Else
    GoSub>Quit
  EndIf
  GetDialogProperty>Dialog2,Edit1,Text,vPos

  If>%vPos%=Complete
    Let>kk=-100
   Goto>Done
  EndIf

  Separate>vPos,;,Cur
//  Sub>Cur_1,%halfSize%
//  Sub>Cur_2,%halfSize%
//  SetControlText>Macro Scheduler Message,TMemo,1,kk
  MoveWindow>Sparkler,%Cur_1%,%Cur_2%
  Let>_WRITE_LOG_FILE=0
  Add>kk,1
  Random>85Per,res
  Add>res,%15Per%
  Random>50,color
  Add>Color,45500
  //Let>Color=16777200
  Let>Color=1880830
  Random>90,ang2
  Let>ang2=%ang2%*4
  GoSub>Angle,Dialog2,Panel1,ang2,%halfSize%,%halfSize%,%halfSize%,2,1
  Random>90,ang3
  Let>ang3=%ang3%*4
  GoSub>Angle,Dialog2,Panel1,ang3,%halfSize%,%halfSize%,%halfSize%,4,1
  Random>90,ang
  Let>ang=%ang%*4
  SetDialogProperty>Dialog2,Panel1,caption,space
  GoSub>Angle,Dialog2,Panel1,ang,%halfSize%,%halfSize%,res,6,color
  Let>_WRITE_LOG_FILE=1
  Label>Done
Until>kk<0
//Angle Usage:
//GoSub>Angle,Dialog,Object,Angle(in degrees),XStart,YStart,Length,PenSize,PenColor
//Requires Drawline subroutine
SRT>Angle
  Let>DegreeAngle=Angle_var_3
  Let>XStart=Angle_var_4
  Let>Ystart=Angle_var_5
  Let>LineLength=Angle_var_6
  Let>RadAngle={%DegreeAngle%*(pi/180)}
  Let>XEnd={trunc((cos(%RadAngle%))*%LineLength%)}
  Let>YEnd={trunc((sin(%RadAngle%))*%LineLength%)}
  Let>XEnd=%XEnd%+%XStart%
  Let>YEnd=%YEnd%+%YStart%
  GoSub>DrawLine,%Angle_var_1%.%Angle_var_2%.Handle,Angle_var_7,Angle_var_8,XStart,YStart,XEnd,YEnd
END>Angle
SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine
*/

/*
BARDDATA:
FFFE4C00650074003E007600550052004C003D00680074007400700073003A002F002F007700770077002E006D006A0074006E00650074002E0063006F006D002F0066006F00720075006D002F00760069006500770074006F007000690063002E007000680070003F0066003D003100260074003D003100340030003300260
070003D0036003100320033002300700036003100320033000D000A000D000A00480054005400500052006500710075006500730074003E007600550052004C002C002C006700650074002C002C0076005200650073000D000A000D000A000D000A00530065007000610072006100740065003E0076005200650073002C0054
006F007000690063005100740079003A003B002C00760054006F0070006900630071000D000A00520061006E0064006F006D003E00760054006F0070006900630071005F0032002C00520061006E0064006F006D004E0075006D006200650072000D000A004100640064003E00520061006E0064006F006D004E0075006D006
200650072002C0031000D000A000D000A0049006600460069006C0065004500780069007300740073003E0025007300630072006900700074005F0064006900720025005C004200610072006400520061006E0064006F006D0073002E007400780074000D000A00200020005200650061006400460069006C0065003E002500
7300630072006900700074005F0064006900720025005C004200610072006400520061006E0064006F006D0073002E007400780074002C00760044006100740061000D000A0020002000530065007000610072006100740065003E00760044006100740061002C00630072006C0066002C0076004C0069006E0065000D000A0
0200020005300750062003E0076004C0069006E0065005F0043006F0075006E0074002C0031000D000A0020002000490066003E007B00250076004C0069006E0065005F0043006F0075006E00740025003E003D002500760054006F0070006900630071005F00320025007D000D000A002000200020002000440065006C0065
0074006500460069006C0065003E0025007300630072006900700074005F0064006900720025005C004200610072006400520061006E0064006F006D0073002E007400780074000D000A002000200020002000570072006900740065004C006E003E0025007300630072006900700074005F0064006900720025005C0042006
10072006400520061006E0064006F006D0073002E007400780074002C0077007200650073002C002D002500520061006E0064006F006D004E0075006D0062006500720025002D000D000A002000200045006C00730065000D000A0020002000200020004C006100620065006C003E0052006500520061006E0064006F006D00
0D000A002000200020002000530065007000610072006100740065003E00760044006100740061002C002D002500520061006E0064006F006D004E0075006D0062006500720025002D002C00760052004E005200650073000D000A002000200020002000490066003E00760052004E005200650073005F0043006F0075006E0
074003E0031000D000A00200020002000200020002000520061006E0064006F006D003E00760054006F0070006900630071005F0032002C00520061006E0064006F006D004E0075006D006200650072000D000A002000200020002000200020004100640064003E00520061006E0064006F006D004E0075006D006200650072
002C0031000D000A0020002000200020002000200047006F0074006F003E0052006500520061006E0064006F006D000D000A00200020002000200045006E006400490066000D000A002000200020002000570072006900740065004C006E003E0025007300630072006900700074005F0064006900720025005C00420061007
2006400520061006E0064006F006D0073002E007400780074002C0077007200650073002C002D002500520061006E0064006F006D004E0075006D0062006500720025002D000D000A002000200045006E006400490066000D000A0045006C00730065000D000A0020002000570072006900740065004C006E003E0025007300
630072006900700074005F0064006900720025005C004200610072006400520061006E0064006F006D0073002E007400780074002C0077007200650073002C002D002500520061006E0064006F006D004E0075006D0062006500720025002D000D000A0045006E006400690066000D000A000D000A000D000A002A002A00420
05200450041004B0050004F0049004E0054002A002A000D000A000D000A00530065007000610072006100740065003E0076005200650073002C0054006F007000690063002500520061006E0064006F006D004E0075006D0062006500720025003A003B002C00760054006F0070006900630063000D000A004C00650074003E
00760054006F007000690063003D00760054006F0070006900630063005F0032000D000A000D000A00530065007000610072006100740065003E0076005200650073002C0054006500780074002500520061006E0064006F006D004E0075006D0062006500720025003A003B002C00760054006500780074000D000A004C006
50074003E00760053007400720069006E0067003D00760054006500780074005F0032000D000A004C0065006E006700740068003E00760053007400720069006E0067002C0076004C0065006E000D000A002F002F004D00690064005300740072003E00760053007400720069006E0067002C0031002C007B00250076004C00
65006E0025002D0031007D002C00760053007400720069006E0067000D000A002F002F004D00690064007300740072003E00760053007400720069006E0067002C0032002C0076004C0065006E002C00760053007400720069006E0067000D000A0053007400720069006E0067005200650070006C006100630065003E00760
053007400720069006E0067002C002600670074003B002C003E002C00760053007400720069006E0067000D000A0053007400720069006E0067005200650070006C006100630065003E00760053007400720069006E0067002C0026006C0074003B002C003C002C00760053007400720069006E0067000D000A005300740072
0069006E0067005200650070006C006100630065003E00760053007400720069006E0067002C00260061006D0070003B002C0026002C00760053007400720069006E0067000D000A0053007400720069006E0067005200650070006C006100630065003E00760053007400720069006E0067002C0028006100740029002C004
0002C00760053007400720069006E0067000D000A000D000A004400690061006C006F0067003E004400690061006C006F00670031000D000A006F0062006A0065006300740020004400690061006C006F00670031003A002000540046006F0072006D000D000A0020002000430061007000740069006F006E0020003D002000
27004200610072006400200053006500630072006500740020004D0065007300730061006700650027000D000A00200020006F0062006A006500630074002000450031003A002000540045006400690074000D000A002000200065006E0064000D000A00200020006F0062006A006500630074002000450032003A002000540
045006400690074000D000A002000200065006E0064000D000A0065006E0064000D000A0045006E0064004400690061006C006F0067003E004400690061006C006F00670031000D000A000D000A005300650074004400690061006C006F006700500072006F00700065007200740079003E004400690061006C006F00670031
002C00450031002C0054006500780074002C00760053007400720069006E0067000D000A005300650074004400690061006C006F006700500072006F00700065007200740079003E004400690061006C006F00670031002C00450032002C0054006500780074002C00760054006F007000690063000D000A000D000A002F002
F00530068006F0077003E004400690061006C006F00670031000D000A000D000A004C006100620065006C003E004C006F006F0070000D000A002000200057006100690074003E0030002E00300031000D000A00200020004700650074004400690061006C006F006700500072006F00700065007200740079003E0044006900
61006C006F00670031002C00450032002C0054006500780074002C00760052006500730070000D000A0020002000490066003E00760052006500730070003D005400680061006E006B00200079006F0075000D000A00200020002000200045007800690074003E0030000D000A002000200045006E006400490066000D000A0
047006F0074006F003E004C006F006F0070000D000A000D000A000D000A000D000A000D000A000D000A000D000A00
*/

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: A little word game for the holidays

Post by Marcus Tettmar » Tue Dec 28, 2021 1:02 pm

Thanks JRL! So who has tried it and how did you do?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts