Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is the POS command in need of a fix?
#3
(09-15-2023, 04:30 AM)SMcNeill Wrote: Can you share some code to showcase what you're speaking about?

I can ( but pardon the quality of the script):
Code: (Select All)
Screen _NewImage(1024, 820, 32)
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", 24, "monospace") '                                                 31 rows, 73 columns text, allows chr$(95)
_Font f&
Dim tiles(100, 2)
' Player's turn sequence is: Pick up, Arrange, Lay Down, Discard

For a = 0 To 11
    For b = 1 To 8
        tiles(a * 8 + b, 1) = b
    Next
Next
For a = 97 To 100: tiles(a, 1) = -1: tiles(a, 2) = 4: Next '                                                                letters are set to A-H and ? for blanks
For a = 1 To 100
    If a < 33 Then tiles(a, 2) = 1 '                                                                                         first 8*4 red
    If a > 32 Then tiles(a, 2) = 2 '                                                                                         next 8*4 green
    If a > 64 Then tiles(a, 2) = 3 '                                                                                         next 8*4 magenta
    If a > 96 Then tiles(a, 2) = 4 '                                                                                         4 blanks white
Next
For a = 1 To 100
    Select Case tiles(a, 2)
        Case Is = 1
            red
        Case Is = 2
            green
        Case Is = 3
            magenta
        Case Is = 4
            white
    End Select
Next

Print Tab(14);
For a = 1 To 100
    Select Case tiles(a, 2)
        Case Is = 1
            red
        Case Is = 2
            green
        Case Is = 3
            magenta
        Case Is = 4
            white
    End Select
    Print Chr$(tiles(a, 1) + 64); " ";
    If a Mod 25 = 0 And Pos(0) > 50 Then Print Tab(14);
Next

Sub red:
    Color _RGB(255, 0, 0)
End Sub

Sub green
    Color _RGB(0, 255, 0)
End Sub

Sub blue
    Color _RGB(0, 0, 255)
End Sub

Sub yellow
    Color _RGB(255, 255, 0)
End Sub

Sub magenta
    Color _RGB(255, 55, 255)
End Sub

Sub white
    Color _RGB(255, 255, 255)
End Sub

Edit: I've found that Pos(0) is 65 after printing a row, and if I add If Pos(o) >64 then Print tab(14); The row is not skipped. 
I was able to achieve the effect I wanted with If a Mod 25 = 0 And Pos(0) > 64 Then v = CsrLin + 1: Locate v, 14
but this seems a bit clumsy.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
RE: Is the POS command in need of a fix? - by PhilOfPerth - 09-15-2023, 04:49 AM



Users browsing this thread: 1 Guest(s)