Advertisement
CVSoft

BASIChat+ Explained

May 2nd, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. :"<>"→Str9
  2. :0→θ
  3. :10→dim(∟BCHAT
  4. :ClrHome
  5. :Output(8,1,"LOADING..."
  6. :If not(sum(∟BCHAT
  7. :Then
  8. :ClrHome
  9. :Input "USERNAME:",Str1
  10. :length(Str1)→∟BCHAT(1
  11. :If ∟BCHAT(1)>9
  12. :9→∟BCHAT(1
  13. :sub(Str1+"{^-1}{^-1}{^-1}{^-1}{^-1}{^-1}{^-1}{^-1}{^-1}",1,9)→Str1
  14. :For(X,1,9
  15. :inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ .-+/º'()?",sub(Str1,X,1))→∟BCHAT(X+1)
  16. :If not(∟BCHAT(X+1
  17. :37→∟BCHAT(X+1
  18. :End
  19. :End
  20. :"+"→Str2
  21. :For(X,1,9)
  22. :Str2+sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ .-+/º'()??",∟BCHAT(X+1),1)→Str2
  23. :End
  24. :sub(Str2,2,∟BCHAT(1))→Str2
  25. :sum(19,1
  26. :Lbl X
  27. :sum(19,0
  28. :ClrHome
  29. :Output(8,1,"BY CVSOFT v1.0-a"
  30. :Stop
  31. :Lbl H
  32. :ClrHome
  33. :If Str9≠"<>"
  34. :Output(1,1,Str9
  35. :Output(8,1,"SEND EXIT"
  36. :Lbl K
  37. :0→X
  38. :0→K
  39. :Repeat K or X=33
  40. :X+1→X
  41. :getKey→K
  42. :End
  43. :If K=11 or K=21 or K=105
  44. :Goto S
  45. :If K=15 or K=22 or K=45
  46. :Goto X
  47. :Str9→Str8
  48. :sum(18)
  49. :If Str9≠Str8
  50. :Goto H
  51. :Goto K
  52. :Lbl S
  53. :ClrHome
  54. :Input "<"+Str2+"> ",Str1
  55. :"<"+Str2+"> "+Str1→Str1
  56. :sum(18)
  57. :sum(17,Str1
  58. :Goto H
  59.  
  60. --------------------Explanation of code, in pseudocode--------------------
  61.  
  62. Store a dummy value to the received data string and store zero to device id
  63. Define list BCHAT
  64. If BCHAT is zero, then:
  65. Input a username
  66. Store the length of the username entry string to a maximum length of 9 characters
  67. Add a bunch of ^-1s to guarantee a length of 9 characters for substringing
  68. Convert the characters in the username to their positions in a string and store in the username list
  69. If not found in string, replace with "?"
  70. (End If)
  71. Define the username string
  72. Convert the username list to a string with the inverse process for creation of the list
  73. Substring any extra characters
  74. Open the Calcnet2 link
  75. Goto Homescreen
  76.  
  77. Label: eXit
  78. Close Calcnet2 link
  79. Stop execution
  80.  
  81. Label: Homescreen
  82. Display recipient's calc ID in row 7
  83. Display menu options in row 8
  84. Label :Key_entry
  85. Define getKey variable
  86. Define counting variable
  87. Loop until counting variable reaches 33 or a key is pressed
  88. If [ENTER], [2nd], or [Y=] (Send menu item) is pressed, Goto Send
  89. If [CLEAR], [MODE], or [GRAPH] (Exit menu item) is pressed, Goto eXit
  90.  
  91. (no usable key was pressed and/or counting variable reached 33)
  92. Store last received data to a temporary string
  93. Get the sent string from the other calculator
  94. If the strings are the same, Goto Key-entry; Else, Goto Homescreen to update display
  95.  
  96. Label: Send
  97. Input message
  98. Add username in "<username> " format
  99. (added in a later version)
  100. Substring if longer than 120 characters (added in a later version)
  101. Store remote device id to a temporary variable
  102. Menu to select recipient: if broadcasted, store zero to theta; else, do nothing
  103. (/added in a later version)
  104. Calcnet2-Send the message with username attached
  105. Restore theta to pre-send value
  106. Goto Homescreen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement