Creating a game in Macro Scheduler

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Creating a game in Macro Scheduler

Post by EnderFFX » Tue Sep 04, 2012 7:20 pm

Too ambitious? I've had a couple ideas for a while now, and I'm doing the networking through a website I have, with SQL calls to confirm connection to the server.

This isn't a graphics game, just more so along the lines of old BBS's systems (anyone remember WWiV?)

Figured I'd make an unusual first chit chat topic. :)

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Post by EnderFFX » Tue Sep 04, 2012 7:38 pm

When I finish up the front end, I'll go ahead and post the code here for it. I think it would be interesting for people to see. (I'll also post the SQL/ASP/HTML back end stuff if anyone is interested)

Basically the way I'm doing it is, the client is making calls to an HTML page (server side) which is returning information used for the front end to validate the user and update the game state.

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

Post by Marcus Tettmar » Tue Sep 04, 2012 8:09 pm

Sounds interesting. Keep us posted.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Post by EnderFFX » Fri Sep 07, 2012 5:53 pm

I'm probably going to release the code this weekend for this. Is there any place where I should put this code as an open project? I'd love to get a base line completed for host/server and then if anyone has any good ideas, to let them update the code and check it out.

I'd love for a couple of smart people to go through it and make suggestions about efficiency.

hpegar
Newbie
Posts: 9
Joined: Tue May 29, 2012 3:08 pm

Where it is the code?

Post by hpegar » Wed Nov 14, 2012 10:30 pm

EnderFFX wrote:I'm probably going to release the code this weekend for this. Is there any place where I should put this code as an open project? I'd love to get a base line completed for host/server and then if anyone has any good ideas, to let them update the code and check it out.

I'd love for a couple of smart people to go through it and make suggestions about efficiency.
Sounds real good, What's up with project?

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Re: Where it is the code?

Post by EnderFFX » Wed Nov 14, 2012 10:51 pm

hpegar wrote:
EnderFFX wrote:I'm probably going to release the code this weekend for this. Is there any place where I should put this code as an open project? I'd love to get a base line completed for host/server and then if anyone has any good ideas, to let them update the code and check it out.

I'd love for a couple of smart people to go through it and make suggestions about efficiency.
Sounds real good, What's up with project?
I'm nearing the beta stage of my game and I'm using MJTnet as a means of pulling emails, posting and reading twitter, and doing some databse manipulation. I will explain and open it up for beta, and release a good amount of the code when it is actually running.

This would have been done monthes ago but work just completely hammered me and I've been on a big project for the last 2 months.

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Post by EnderFFX » Wed Nov 14, 2012 10:56 pm

And I know this seems off from the first post. I'm actually working on two projects at the moment, both MJTnet games. One is a more traditional game the other is a twitter game. The twitter game is entering the beta stage, the other I have not had time to work on.

I apologize if that was confusing.

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

Post by JRL » Mon Nov 19, 2012 4:44 am

At the start of this thread EnderFFX wrote:Too ambitious?
Hmmmm...

You started this thread only six weeks ago. I say "only" because I've been working at making a game also and I started it 2 years ago. Not that I've been working on it all this time. I sent jpuziano a copy to evaluate back then. He had problems I had trouble resolving and then after a couple of weeks it just kind of fizzled. The idea came back to life a few weeks ago and I got it working or so I thought.

What I made was a little game that lets you select an image file to be displayed in randomly rearranged squares. One square would be blank and you could "slide" any adjacent image square into the blank space. You keep doing that until you ultimately put the image back together. Trouble was the game was just too hard. Then I foundthis. It was proven back in 1879 that half of the starting positions for a puzzle of this type are impossible to solve. So my surmise that it was "just too hard" is an understatement.

Now I've rewritten the game to be what I call a Chop Saw Puzzle. The game lets you select an image then it breaks the image into rectangular tiles and spreads them about the screen randomly. You then get to put your picture back together by dragging individual pieces and joining them with their neighbors.

The game is getting close but isn't finished yet. I'll post when I have something.

I don't intend to actually play the game. To me making it is more fun than the game could be. Someone else recently mentioned they had a game they were creating. Marcus blogged one last Christmas but I don't know where he got it from and I don't know if it was made it using Macro Scheduler. So, is making a game with Macro Scheduler too ambitious? I don't think so.
EnderFFX wrote: Is there any place where I should put this code as an open project?
Pick an mjtnet forum. Any mjtnet forum.

Edit: 11/06/2015
Here is the sliding puzzle I created back in June of 2010.

Code: Select all

Let>msg_xpos=1600
Let>msg_ypos=20

OnEvent>Key_Down,VK27,0,Quit
Let>Opacity=250
Let>ClickCount=0
Let>ClickFlag=0

GoSub>GetBorders
GoSub>GetImage
GoSub>Scramble,Kx,Ky

  Let>ScriptName=%temp_Dir%Dialogtest.scp
  IfFileExists>ScriptName
    DeleteFile>ScriptName
  EndIf

Let>scrX=Dimension_1
Let>scrY=Dimension_2
Let>Xstart=0
Let>Ystart=0
Let>Xspan={round(%scrX%/%kX%)}
Let>Yspan={round(%scrY%/%kY%)}
Let>TileX={round(%Dimension_1%/%kx%)}
Let>TileY={round(%Dimension_2%/%ky%)}
Let>Tilerow=0
Let>TileCol=0
Let>krow=0
Let>kcol=0
Let>kk=0
Let>TileTotal=%kX%*%kY%
SetDialogProperty>DialogSetup,Label1,Caption,Creating Tiles... Please Wait...


Repeat>krow
  Add>krow,1
  Repeat>kcol
    Add>kcol,1
    Add>kk,1
    Let>TileX_%kk%=%tileCol%
    Let>TileY_%kk%=%tileRow%
    Let>TileRow=%TileRow%+%TileY%
    Let>Xpos={(%krow%*%Xspan%)-%Xspan%+%xstart%}
    Let>Ypos={(%kcol%*%Yspan%)-%Yspan%+%Ystart%}
    Let>Xpos_%kk%=Xpos
    Let>Ypos_%kk%=Ypos
    GoSub>MakeDialog,%kk%,%Xspan%,%Yspan%,-32000,-32000
  Until>kcol,%kY%
  Let>TileCol={%TileCol%+%tileX%}
  Let>TileRow=0
  Let>kcol=0
Until>krow,%kX%

Include>ScriptName

Dialog>DialogTI1
object DialogTI1: TForm
  AutoSize = True

  BorderStyle = bsNone
  FormStyle = fsStayOnTop
  Caption = 'ThrowImage'
  object MSImage1: tMSImage
    Left = 0
    Top = 0
    AutoSize = True
  end
end
EndDialog>DialogTI1

Show>DialogTI1

MoveWindow>ThrowImage,0,0

SetDialogProperty>DialogTI1,MSImage1,LoadImage,Image

  GetDialogProperty>DialogTI1,,ClientWidth,Show>DialogTI1W
  GetDialogProperty>DialogTI1,,ClientHeight,Show>DialogTI1H
  GetDialogProperty>DialogTI1,,Left,Show>DialogTI1X
  GetDialogProperty>DialogTI1,,Top,Show>DialogTI1Y

  Show>DialogTI1

LibFunc>user32,GetDC,HDCTI1,DialogTI1.handle

SetDialogProperty>DialogSetup,Label1,Caption,Still creating Tiles...


Separate>Position_list,;,pos
Let>MoveKK=0
Repeat>MoveKK
  Add>MoveKK,1
  Let>value=Pos_%MoveKK%
  Let>Name=D~L~o~g%value%
  Let>Xpos=Xpos_%MoveKK%
  Let>Ypos=Ypos_%MoveKK%
  MoveWindow>%Name%,%Xpos%,%Ypos%
  SetDialogProperty>DynamicDialog%MoveKK%,,AlphaBlendValue,255
Until>MoveKK,%pos_count%


Let>showk=0
Repeat>showk
  Random>16777214,rand_color
  Let>color=rand_color
  Add>showk,1
  Show>DynamicDialog%showk%
  Let>WinName=D~L~o~g%showk%
  GetWindowPos>WinName,WinNameX,WinNameY
  Let>MouseX=%WinNameX%+%Xspan%
  Let>MouseY=%WinNameY%+%Yspan%

    LibFunc>user32,GetDC,HDC%showk%,DynamicDialog%showk%.Handle
    
    

    If>%showk%=%TheOne%
      SetDialogObjectColor>DynamicDialog%showk%,,11
      ResizeWindow>%WinName%,%Xspan%,%Yspan%
    Else
      SetDialogObjectColor>DynamicDialog%showk%,,color
      ResizeWindow>%WinName%,%Xspan%,%Yspan%
      LibFunc>Gdi32,StretchBlt,SBres,HDC%showk%,0,0,%Xspan%,%Yspan%,HDCTI1,TileX_%showk%,TileY_%showk%,TileX,TileY,13369376
    EndIf
    
    
Until>showk,%kk%

SetDialogProperty>DialogSetup,Label1,Caption,Displaying Tiles...



CloseDialog>DialogSetup
CloseDialog>DialogLatice
CloseDialog>DialogTI1



SRT>MakeDialog
WriteLn>ScriptName,wres,Dialog>DynamicDialog%MakeDialog_var_1%
WriteLn>ScriptName,wres,object DynamicDialog%MakeDialog_var_1%: TForm
WriteLn>ScriptName,wres,  BorderStyle = bsNone
WriteLn>ScriptName,wres,  AutoScroll = False
WriteLn>ScriptName,wres,  AlphaBlend = True
WriteLn>ScriptName,wres,  AlphaBlendValue = 0
WriteLn>ScriptName,wres,  Caption = 'D~L~o~g%MakeDialog_var_1%'
WriteLn>ScriptName,wres,  ClientHeight = 0
WriteLn>ScriptName,wres,  ClientWidth = 0
WriteLn>ScriptName,wres,  object msLabel1: TLabel
WriteLn>ScriptName,wres,    Left = 35
WriteLn>ScriptName,wres,    Top = 10
WriteLn>ScriptName,wres,    Width = 45
WriteLn>ScriptName,wres,    Height = 13
WriteLn>ScriptName,wres,    Caption = ' '
WriteLn>ScriptName,wres,  end
If>TileNumbers=True
  WriteLn>ScriptName,wres,  object msButton1: tMSButton
  WriteLn>ScriptName,wres,    Left = 0
  WriteLn>ScriptName,wres,    Top = 0
  WriteLn>ScriptName,wres,    Width = 30
  WriteLn>ScriptName,wres,    Height = 25
  WriteLn>ScriptName,wres,    Caption = '%MakeDialog_var_1%'
  WriteLn>ScriptName,wres,  end
EndIf
WriteLn>ScriptName,wres,end
WriteLn>ScriptName,wres,EndDialog>DynamicDialog%MakeDialog_var_1%
WriteLn>ScriptName,wres,  EndIf
END>MakeDialog

OnEvent>Key_Down,VK1,0,MoveWin
Label>Loop
  GetDialogAction>DynamicDialog%TheOne%,res1
  If>res1=2
    GoSub>Quit
  EndIF
  Wait>0.01
  If>ClickFlag>0
    Add>ClickFlag,1
    If>ClickFlag>10
      Let>ClickFlag=0
    EndIf
  EndIf
Goto>Loop

Let>kk=0

SRT>MoveWin
  If>ClickFlag=0
  Add>ClickFlag,1
  GetActiveWindow>WinTitle,WinX,WinY
  MidStr>WinTitle,1,7,First
  If>First=D~L~o~g
    Add>ClickCount,1
    Let>TheDialog=DynamicDialog%theone%
    Let>%theDialog%.mslabel1=ClickCount
    SetDialogObjectColor>%theDialog%,mslabel1,16777215
    ResetDialogAction>%thedialog%
    Let>TheWindow=D~L~o~g%theone%
    MidStr>WinTitle,8,1,Second
    GetWindowPos>%TheWindow%,TOx,TOy
    GetWindowPos>%WinTitle%,WinX,WinY
    Let>answerX={abs(%winx%-%tox%)}
    Let>answery={abs(%winy%-%toy%)}
    If>{(%answerx%<(%tilex%+10))and(%answery%<(%tiley%+10))}
      Movewindow>%WinTitle%,TOx,TOy
      MoveWindow>%TheWindow%,WinX,WinY
    EndIf
  EndIf
  EndIf
END>MoveWin

//Usage:
//GoSub>MakeOpaque,Window Name,Opacity number (0-255) zero is invisible
//For Example
//GoSub>MakeOpaque,Notepad*,90
SRT>MakeOpaque
  If>%MakeOpaque_var_2%=
    Let>MakeOpaque_var_2=255
  EndIf
  If>MakeOpaque_var_1<>
    GetWindowHandle>%MakeOpaque_var_1%,HndWin
    //constants
    Let>GWL_EXSTYLE=-20
    Let>WS_EX_LAYERED=524288
    Let>LWA_ALPHA=2
    //get style attributes of window
    LibFunc>user32,GetWindowLongA,attribs,%HndWin%,GWL_EXSTYLE
    Let>attribs={%attribs% OR %WS_EX_LAYERED%}
    //make window transparent
    LibFunc>user32,SetWindowLongA,swl,%HndWin%,GWL_EXSTYLE,attribs
    LibFunc>user32,SetLayeredWindowAttributes,res,%HndWin%,0,%MakeOpaque_var_2%,LWA_ALPHA
  EndIf
END>MakeOpaque

SRT>GetBorders
  Dialog>TitleBarSizeCalculation
  Button=1,0,0,75,25,0
  EndDialog>TitleBarSizeCalculation
  Let>WIN_USEHANDLE=1
  GetWindowPos>TitleBarSizeCalculation.handle,DiaPosX,DiaPosY
  GetWindowPos>TitleBarSizeCalculation.msButton1.handle,OffSetX,OffSetY
  Let>WIN_USEHANDLE=0
  Sub>OffSetX,%DiaPosX%
  Sub>OffSetY,%DiaPosY%
END>GetBorders

SRT>GetImage
  Let>SM_XVIRTUALSCREEN=76
  Let>SM_YVIRTUALSCREEN=77
  Let>SM_CXVIRTUALSCREEN=78
  Let>SM_CYVIRTUALSCREEN=79

  LibFunc>User32,GetSystemMetrics,VScrWidth,SM_CXVIRTUALSCREEN
  LibFunc>User32,GetSystemMetrics,VScrHeight,SM_CYVIRTUALSCREEN
  LibFunc>User32,GetSystemMetrics,VScrLeft,SM_XVIRTUALSCREEN
  LibFunc>User32,GetSystemMetrics,VScrTop,SM_YVIRTUALSCREEN

  ScreenCapture>VScrLeft,VScrTop,VScrWidth,VScrHeight,%temp_dir%screencap.bmp

  Wait>0.5
  SRT>SetDialogSetupResult
    Let>res10=3
  END>SetDialogSetupResult
  
////////////////////////////////////////////////Dialog Stuff

Dialog>DialogSetup
object DialogSetup: TForm
  Left = 329
  Top = 205
  HelpContext = 5000
  BorderIcons = []
  Caption = 'Select an Image to Reassemble'
  ClientHeight = 550
  ClientWidth = 500
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesktopCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 176
    Height = 26
    Caption = '' +
      'Select an image (BMP or JPG only).'#13#10'Or select nothing to use you' +
      'r desktop'
  end
  object Label2: TLabel
    Left = 8
    Top = 184
    Width = 101
    Height = 13
    Caption = 'Approximate Tile Size'
  end
  object Label3: TLabel
    Left = 53
    Top = 206
    Width = 7
    Height = 13
    Caption = 'X'
  end
  object Label4: TLabel
    Left = 8
    Top = 8
    Width = 288
    Height = 13
    Caption = 'This is a game written with Macro Scheduler by Dick Lockey'
  end
  object Label5: TLabel
    Left = 8
    Top = 32
    Width = 286
    Height = 13
    Caption = 'The object of the game is to reassemble a scrambled picture'
  end
  object Label6: TLabel
    Left = 8
    Top = 56
    Width = 143
    Height = 13
    Caption = 'You can choose an image file'
  end
  object Label7: TLabel
    Left = 8
    Top = 80
    Width = 274
    Height = 13
    Caption = 'Or make no choice and the program will use your desktop'
  end
  object Label8: TLabel
    Left = 8
    Top = 104
    Width = 205
    Height = 13
    Caption = 'Rearrange the tiles by clicking next to the black tile'
  end
  object Label9: TLabel
    Left = 8
    Top = 128
    Width = 205
    Height = 13
    Caption = 'Press ESC to exit the game'
  end
  object Edit1: TEdit
    Left = 10
    Top = 151
    Width = 431
    Height = 21
    TabOrder = 0
  end
  object MSButton1: tMSButton
    Left = 448
    Top = 151
    Width = 40
    Height = 21
    DoubleBuffered = True
    Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}
    ParentDoubleBuffered = False
    TabOrder = 1
    DoBrowse = False
    Filter = 'Any file (*.*)|*.*|JPGs (*.jpg)|*.jpg|BMPs (*.bmp)|*.bmp'
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 332
    Top = 520
    Width = 75
    Height = 25
    Caption = 'OK'
    Default = True
    DoubleBuffered = True
    Glyph.Data = {
      DE010000424DDE01000000000000760000002800000024000000120000000100
      0400000000006801000000000000000000001000000000000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
      3333333333333333333333330000333333333333333333333333F33333333333
      00003333344333333333333333388F3333333333000033334224333333333333
      338338F3333333330000333422224333333333333833338F3333333300003342
      222224333333333383333338F3333333000034222A22224333333338F338F333
      8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
      33333338F83338F338F33333000033A33333A222433333338333338F338F3333
      0000333333333A222433333333333338F338F33300003333333333A222433333
      333333338F338F33000033333333333A222433333333333338F338F300003333
      33333333A222433333333333338F338F00003333333333333A22433333333333
      3338F38F000033333333333333A223333333333333338F830000333333333333
      333A333333333333333338330000333333333333333333333333333333333333
      0000}
    ModalResult = 3
    NumGlyphs = 2
    ParentDoubleBuffered = False
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton3: tMSButton
    Left = 416
    Top = 520
    Width = 75
    Height = 25
    DoubleBuffered = True
    Kind = bkCancel
    ParentDoubleBuffered = False
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit2: TEdit
    Left = 10
    Top = 202
    Width = 30
    Height = 21
    TabOrder = 4
    Text = '300'
  end
  object Edit3: TEdit
    Left = 73
    Top = 202
    Width = 30
    Height = 21
    TabOrder = 5
    Text = '300'
  end
  object MSButton4: tMSButton
    Left = 10
    Top = 238
    Width = 300
    Height = 300
    Caption = 'Pick here'#13'to resize tile'
    DoubleBuffered = True
    Font.Charset = ANSI_CHARSET
    Font.Color = clBlue
    Font.Height = -11
    Font.Name = 'Arial'
    Font.Style = [fsBold]
    ParentDoubleBuffered = False
    ParentFont = False
    TabOrder = 6
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object CheckBox1: TCheckBox
    Left = 129
    Top = 202
    Width = 176
    Height = 17
    Caption = 'Use helper numbers on tiles'
    TabOrder = 7
  end
end
EndDialog>DialogSetup

  Let>kk=1
  AddDialogHandler>DialogSetup,MSButton1,OnClick,DoBrowse
  AddDialogHandler>DialogSetup,msButton2,OnCLick,SetDialogSetupResult
  AddDialogHandler>DialogSetup,msButton3,OnCLick,Quit
  AddDialogHandler>DialogSetup,msButton4,OnMouseDown,ReSizeButton
  AddDialogHandler>DialogSetup,msButton4,OnMouseUp,StopReSizeButton
  SetDialogProperty>DialogSetup,Label1,Caption,
  SetDialogObjectVisible>DialogSetup,label1,0
  SetDialogObjectFont>DialogSetup,Label1,Arial,13,1,1111
  SetDialogObjectFont>DialogSetup,Label4,Arial,13,1,111111
  SetDialogObjectFont>DialogSetup,Label5,Arial,13,1,111111
  SetDialogObjectFont>DialogSetup,Label6,Arial,13,1,111111
  SetDialogObjectFont>DialogSetup,Label7,Arial,13,1,111111
  SetDialogObjectFont>DialogSetup,Label8,Arial,13,1,111111
  SetDialogObjectFont>DialogSetup,Label9,Arial,13,1,111111
  SetDialogObjectColor>DialogSetup,,16766635
  Show>DialogSetup
  Label>DialogSetupLoop
    If>res10=3
      Goto>LeaveDialogSetupLoop
    EndIf
    GetDialogProperty>DialogSetUp,Edit2,Text,TileW
    GetDialogProperty>DialogSetUp,Edit3,Text,TileH
    SetDialogProperty>DialogSetUp,msButton4,Width,TileW
    SetDialogProperty>DialogSetUp,msButton4,Height,TileH
    GetDialogProperty>DialogSetUp,checkbox1,Checked,tilenumbers

  Goto>DialogSetupLoop
  Label>LeaveDialogSetupLoop
  GetDialogProperty>DialogSetup,Edit1,Text,image
  SetDialogObjectVisible>DialogSetup,msButton1,0
  SetDialogObjectVisible>DialogSetup,msButton2,0
  SetDialogObjectVisible>DialogSetup,label1,1
  SetDialogObjectVisible>DialogSetup,label4,0
  SetDialogObjectVisible>DialogSetup,label5,0
  SetDialogObjectVisible>DialogSetup,label6,0
  SetDialogObjectVisible>DialogSetup,label7,0
  SetDialogProperty>DialogSetup,Label1,Caption,Randomizing element positions.  Please Wait...
///////////////////////////////////////////////////End Dialog stuff

CloseDialog>DialogSetup

  If>image=
    Let>image=%temp_dir%screencap.bmp
  EndIf
  Separate>image,.,extension
  Let>value=extension_%extension_count%
  If>{((upper(%Value%))="JPG")or((upper(%Value%))="BMP")}
  Else
    MDL>File type selected is not a JPG or BMP file.  Exiting program
    Exit>0
  EndIf
  
  VBSTART
    Function ImgDimensions (ImgFile)
    dim myImg, fs
    Set fs= CreateObject("Scripting.FileSystemObject")
    If fs.fileExists(ImgFile) Then
    Set myImg = Loadpicture(ImgFile)
    iWidth = round(myImg.width / 26.4583)
    iHeight = round(myImg.height / 26.4583)
    Set myImg = nothing
    ImgDimensions = iWidth & "X" & iHeight
    End If
    End Function
  VBEND

  VBEval>ImgDimensions("%Image%"),ImageSize
  Separate>ImageSize,X,Dimension

  Let>Width={%Dimension_1%+%OffSetX%+%OffSetX%+100}
  Let>Height={%Dimension_2%+%OffSetY%+%OffSetX%+%OffSetX%+100}
  
  Let>kx={round(%Dimension_1%/%TileW%)}
  Let>ky={round(%Dimension_2%/%TileH%)}
END>GetImage

SRT>ReSizeButton
  Let>StopReSize=0
  Label>StartReSizeButton
  GetCursorPos>ButCurX,ButCurY
  Let>WIN_USEHANDLE=1
  GetWindowPos>DialogSetup.handle,DialogX,DialogY
  GetWindowPos>DialogSetup.msButton4.handle,But4X,But4Y
  Let>WIN_USEHANDLE=0
  Let>TileW={%ButCurX%-%But4X%}
  Let>TileH={%ButCurY%-%But4Y%}
  If>{(%tileW%>49)and(%tileW%<301)}
    SetDialogProperty>DialogSetUp,msButton4,Width,TileW
    SetDialogProperty>DialogSetUp,Edit2,Text,TileW
  EndIf
  If>{(%tileH%>49)and(%tileH%<301)}
    SetDialogProperty>DialogSetUp,msButton4,Height,TileH
    SetDialogProperty>DialogSetUp,Edit3,Text,TileH
  EndIf
  If>StopReSize=0
    Goto>StartReSizeButton
  EndIf
  SRT>StopReSizeButton
    Let>StopReSize=1
  END>StopReSizeButton
  
END>ReSizeButton

SRT>Scramble
  Let>count=%kx%*%ky%
  Random>%count%,TheOne
  Add>TheOne,1
  Let>numberlist=~1~;
  Let>count_kk=1
  Repeat>count_kk
    Add>count_kk,1
    Let>numberlist=%numberlist%~%count_kk%~;
  Until>count_kk=%count%
  
  Let>position_list=
  Let>count_kk=0
  Let>RandomNumberList=
  Label>MakeRandomListStart
  Add>Count_kk,1

  Random>count,number
  Add>number,1
  Separate>numberlist,;,numbervar
  Let>Number=numbervar_%number%
  Let>position_list=%position_list%;%number%
  StringReplace>NUMBERLIST,%number%;,,NUMBERLIST
  Sub>count,1
  If>count=0
    Goto>MakeRandomListEnd
  Else
    Goto>MakeRandomListStart
  EndIf
 
  Label>MakeRandomListEnd
  StringReplace>position_list,~,,position_list
  MidStr>position_list,2,1111111,position_list
END>Scramble

SRT>Quit
  Let>exitk=0
  Repeat>Exitk
    Add>exitk,1
    LibFunc>user32,ReleaseDC,RDCres,Dialog%exitk%.Handle,HDC%exitk%
  Until>Exitk,%kk%
  Exit>0
END>Quit

SRT>DoBrowse
  SetDialogProperty>DialogSetup,MSButton1,DoBrowse,True
  GetDialogProperty>DialogSetup,MSButton1,FileName,strFileName
  SetDialogProperty>DialogSetup,Edit1,Text,strFileName
END>DoBrowse


//DrawRectangle Usage:
//GoSub>DrawRectangle,WindowHandle,PenSize,PenColor,SolidColor,ULXLocation,ULYLocation,LRXLocation,LRYLocation

SRT>DrawRectangle
  LibFunc>user32,GetDC,HDC,%DrawRectangle_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawRectangle_var_2%,%DrawRectangle_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  LibFunc>gdi32,CreateSolidBrush,SBres,%DrawRectangle_var_4%
  LibFunc>gdi32,SelectObject,SOres,hdc,sbres
  LibFunc>gdi32,Rectangle,recres,hdc,%DrawRectangle_var_5%,%DrawRectangle_var_6%,%DrawRectangle_var_7%,%DrawRectangle_var_8%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>gdi32,DeleteObject,DOres,sbres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawRectangle

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Post by EnderFFX » Tue Dec 11, 2012 9:36 pm

"I don't intend to actually play the game. To me making it is more fun than the game could be. Someone else recently mentioned they had a game they were creating. Marcus blogged one last Christmas but I don't know where he got it from and I don't know if it was made it using Macro Scheduler. So, is making a game with Macro Scheduler too ambitious? I don't think so"

Yeah I've noticed that designing and programming is much more satisfying than playing. :)

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