home *** CD-ROM | disk | FTP | other *** search
- $AMOEBA
-
- ' COMMENTS:
- ' * Cannot use contants from ACC lib, you have to type them as numbers,
- ' and you have to type them as signed numbers!
- ' * Don't know how to exit in the middle of script, Goto not supported
-
- '******************
- $COMMAND=handle
- $COMMENT=Get handle of entity
-
- Option Explicit
-
- DoIt ' Call the function
-
- Private Sub DoIt
- Dim Point, Entity
-
- If 2 <> ACCLib.GetEnt("Select entity", "", "", Entity, Point) Then
- ACCLib.Prompt Chr(10) + "Bad selection"
- Exit Sub
- End If
-
- ACCLib.Prompt Chr(10) + "Handle is: 0x" + Hex(Entity)
- End Sub
-
- '******************
- $COMMAND=highlite
- $COMMENT=Highlite entity with given handle
-
- Option Explicit
-
- DoIt ' Call the function
-
- Private Sub DoIt
- Dim Handle, Dummy
-
- If 2 <> ACCLib.GetLong("Entity handle (decimal)", "", "", Handle) Then
- ACCLib.Prompt Chr(10) + "Bad handle"
- Exit Sub
- End If
-
- If 0 <> ACCLib.Draw(Handle, 2) Then
- ACCLib.Prompt Chr(10) + "Bad handle"
- Exit Sub
- End If
-
- ACCLib.GetLong "Press enter to continue", "", "", Dummy
-
- ACCLib.Draw Handle, 0
-
- End Sub
-
- '*******************
- $COMMAND=makeline
- $COMMENT=Create line
-
- Option Explicit
-
- DoIt ' Call the function
-
- Private Sub DoIt
- Dim StartP, EndP, Line
-
- If 2 <> ACCLib.GetPoint("Get start point", "", "", StartP) Then
- ACCLib.Prompt Chr(10) + "Bad point"
- Exit Sub
- End If
-
- If 2 <> ACCLib.GetPoint("Get end point", "", "", EndP) Then
- ACCLib.Prompt Chr(10) + "Bad point"
- Exit Sub
- End If
-
- ACCLib.LINE_Make StartP, EndP, -2147483645, -2147483645, -2147483645, 0.0, 0, Line
-
- ACCLib.Prompt Chr(10) + "Handle of line: 0x" + Hex(Line)
- End Sub
-
- '******************
- $COMMAND=getvar
- $COMMENT=Get value of any variable
- Option Explicit
-
- DoIt ' Call the function
-
- Private Sub DoIt
- Dim VarName, VarT, Variable, String
-
- If 2 <> ACCLib.GetString("Variable name", "", VarName) Then
- ACCLib.Prompt Chr(10) + "Bad name"
- Exit Sub
- End If
-
- If 0 > ACCLib.V_Get(VarName, VarT, Variable) Then
- ACCLib.Prompt Chr(10) + "Variable doesn't exist"
- Exit Sub
- End If
-
- Select Case VarT
- Case 1
- String = "String: " + Variable
- Case 2
- String = "Double: " + CStr(Variable)
- Case 3
- String = "Integer: " + CStr(Variable)
- Case 4
- String = "Point: (" + CStr(Variable.x) + ", " + CStr(Variable.y) + ")"
- Case Else
- String = "Unknown"
- End Select
-
- ACCLib.Prompt Chr(10) + String
-
- End Sub
-
- '*******************
- $COMMAND=graph
- $COMMENT=Draw graph
-
- Option Explicit
-
- DoIt ' Call the function
-
- Private Sub DoIt
- Dim FromX, ToX, StepX, X, LastY, Result
- Dim StartP, EndP, OriginP
-
- Set StartP = CreateObject("ACC.Point")
- Set EndP = CreateObject("ACC.Point")
- Set OriginP = CreateObject("ACC.Point")
-
- Result = ACCLib.GetDouble("From x", "", "-10", FromX)
- If Result = 3 Then
- FromX = -10.0
- ElseIf Result <> 2 Then
- ACCLib.Prompt Chr(10) + "Bad value"
- Exit Sub
- End If
-
- Result = ACCLib.GetDouble("To x", "", "10", ToX)
- If Result = 3 Then
- ToX = 10.0
- ElseIf Result <> 2 Then
- ACCLib.Prompt Chr(10) + "Bad value"
- Exit Sub
- End If
-
- Result = ACCLib.GetDouble("Step", "", "0.1", StepX)
- If Result = 3 Then
- StepX = 0.1
- ElseIf Result <> 2 Then
- ACCLib.Prompt Chr(10) + "Bad value"
- Exit Sub
- End If
-
- Result= ACCLib.GetPoint("Origin", "", "0,0", OriginP)
- If Result = 3 Then
- OriginP.x = 0.0
- OriginP.y = 0.0
- ElseIf Result <> 2 Then
- ACCLib.Prompt Chr(10) + "Bad value"
- Exit Sub
- End If
-
- StartP.x = OriginP.x + FromX
- StartP.y = OriginP.y + Func(FromX)
- For X = FromX+StepX To ToX Step StepX
- Dim Line
- EndP.x = X
- EndP.y = Func(X)
- EndP = ACCLib.G_AddVV(EndP, OriginP)
- ACCLib.LINE_Make StartP, EndP, -2147483645, -2147483645, -2147483645, 0.0, 0, Line
- StartP.x = EndP.x
- StartP.y = EndP.y
- Next
-
- End Sub
-
- ' place your function here
- Private Function Func(X)
- Func = Sin(X) * X
- End Function