Posts: 576
Threads: 148
Joined: Oct 2007
Reputation:
1
04-17-2008, 10:14 AM
(This post was last modified: 04-17-2008, 10:38 AM by Admin 1.)
Since the Macro feature is a form of the BASIC programing language, and I've done some BASIC programing myself, does anyone think a game could be created using the Macro feature of DeltaCad?
If possible, I think this would take DeltaCad into an entirely "outside the box" realm of typical CAD software.
This, of course, is not a request, per say. So even I, "The Boss", question whether this is the proper location for this topic on these forums. ![Rolleyes Rolleyes](http://www.deltacadusersgroup.org/Forums/images/smilies/rolleyes.gif) However, I would like any thoughts or opinions that any of you may have on this potential "exploit", for lack of a better word, of the Macro feature in DeltaCad.
Naturally, if anyone wants to play with this idea and would like to share what you've done, even if extremely simplistic, please share it on this web site. It would be interesting to see what can be done with the DeltaCad Macro feature, besides it's intended purpose of creating drawings from inputs given to the program (Macro).
A thought here, perhaps a maze navigation type game could be possible. Hmmm?
Concept: A maze would be drawn and then you'd have to work your way through it via inputs to the software which would draw your movement path. Again, this is not a request. But, could it be done, in theory?
Discuss....
Posts: 57
Threads: 13
Joined: Oct 2007
Reputation:
0
04-17-2008, 03:14 PM
(This post was last modified: 04-17-2008, 06:41 PM by Admin 1.)
That's a great idea Boss! Presently, I am NOT a programmer, but I've always had an interest in learning more about macros. When I get a chance, I play around with the DC macros and check out the code, etc. There is so much to learn! Currently, in my spare time, I'm studying PHP, MYSQL, CSS, website security....yada yada. It would be cool to see what people here can come up with. I know I would learn a lot more about it here!
Kev-
Posts: 389
Threads: 54
Joined: Apr 2014
Reputation:
8
Here is a simple macro that draws a short line in 8 different directions, could be used to navigate thru a maze or use as a Etch-A Sketch ®.
Code:
Sub Main
Dim scale As Double
Dim vLeft As Double
Dim vBottom As Double
Dim vRight As Double
Dim vTop As Double
Dim LastLine(1000,3)
MV=.25 '<- Amount of X & Y movement
DColor=0: LastL=1
Xpos=0: Ypos=0: Xstart=0: Ystart=0
dcSetLineParms DColor, dcSOLID, dcTHIN '<- dcThin dcNormal dcThick dcHeavy
dcCreateBox -11.5, -5, 11.5, 5 '<- Lower Left and Upper Right corners of Drawing Area
dcViewAll
dcGetViewScaleandRect scale, vLeft, vBottom, vRight, vTop
dcSelectObjInBox vLeft, vBottom, vRight, vTop
dcEraseSelObjs
dcCreateCircle Xpos, Ypos, .05
Begin Dialog Sketch 10,0, 95, 145, "DeltaCAD-A-Sketch", .Enable
TextBox 7,70,40,15, .StringX
TextBox 47,70,40,15, .StringY
PushButton 18, 4,20,20, "\", .UpLeft
PushButton 38, 4,20,20, "/\", .Up
PushButton 58, 4,20,20, "/", .UpRight
PushButton 18,24,20,20, "<", .Left
PushButton 58,24,20,20, ">", .Right
PushButton 18,44,20,20, "/", .DownLeft
PushButton 38,44,20,20, "\/", .Down
PushButton 58,44,20,20, "\", .DownRight
PushButton 38,24,20,20, "Color",.DCColor
PushButton 23,90,50,15, "Clear",.Clear
PushButton 23,105,50,15, "Quit", .Quit
PushButton 23,120,50,15, "Back", .Back
End Dialog
Dim Dlg1 As Sketch
GetButton:
Dlg1.StringX = "X" + Str$(Xpos)
Dlg1.StringY = "Y" + Str$(Ypos)
B = Dialog( Dlg1 )
If B=1 Or B=4 Or B=6 Then
If Xpos>=vLeft+MV-.05 Then Xpos=Xpos-MV
End If
If B=3 Or B=5 Or B=8 Then
If Xpos<=vRight-MV+.05 Then Xpos=Xpos+MV
End If
If B=1 Or B=2 Or B=3 Then
If Ypos<=vTop-MV+.05 Then Ypos=Ypos+MV
End If
If B=6 Or B=7 Or B=8 Then
If Ypos>=vBottom+MV-.05 Then Ypos=Ypos-MV
End If
If B>0 And B<9 Then
dcCreateLine Xstart, Ystart,Xpos, Ypos
LastLine(LastL,1) = Xpos
LastLine(LastL,2) = Ypos
LastLine(LastL,3) = DColor
LastL = LastL + 1
Xstart=Xpos:Ystart=Ypos
End If
If B=9 Then
DColor=DColor+1
If DColor>14 Then DColor=0
dcSetLineParms DColor, dcSOLID, dcTHIN
End If
If B=10 Then
dcSelectObjInBox vLeft, vBottom, vRight, vTop
Xpos=0: Ypos=0: Xstart=0: Ystart=0
dcEraseSelObjs
dcCreateCircle 0, 0, .05
DColor=0: LastL=1
End If
If B=11 Then End
If B=12 And LastL>1 Then
Xpos=0: Ypos=0: Xstart=0: Ystart=0
dcSelectObjInBox vLeft, vBottom, vRight, vTop
dcEraseSelObjs
dcCreateCircle 0, 0, .05
LastL=LastL-1
For L=1 to LastL-1
Xpos=LastLine(L,1)
Ypos=LastLine(L,2)
DColor=LastLine(L,3)
dcSetLineParms DColor, dcSOLID, dcTHIN
dcCreateLine Xstart, Ystart,Xpos, Ypos
Xstart=Xpos:Ystart=Ypos
Next L
End If
GoTo GetButton
End Sub
Posts: 571
Threads: 91
Joined: Sep 2008
Reputation:
4
|