November 28, 2020, 10:46:42 AM

Author Topic: [bmx] Another Console by neos300 [ 1+ years ago ]  (Read 477 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bmx] Another Console by neos300 [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Another Console
Author : neos300
Posted : 1+ years ago

Description : This is a very simple console. This doesn't display your console, only stores it. To display your console use this:
Code: [Select]
For str$ = EachIn Console.Text
'Do your display stuff here
Next


To add something to the console use:
Code: [Select]
Console.cPrint("Your text here!")


To set and retrive cvars:
Code: [Select]
'Get
Console.GetCVAR("name")
'Set
Console.RegisterCVAR("Name", "Value")


You will also need to design your own input protocools, which i will put in later. [/i]

Code :
Code: BlitzMax
  1. Type TConsole
  2. Field Text:TList
  3. Field cvars:TList
  4.  
  5. Method cPrint(msg$)
  6. ListAddLast(Text, msg$)
  7. End Method
  8.  
  9. Method RegisterCVAR(cvar$, val$)
  10. For Local C:CVAR = EachIn cvars
  11.         If C.name = cvar
  12.                 C.value = val
  13.                 Return 1
  14.         EndIf
  15. Next
  16. Local B:CVAR
  17. B.name = cvar
  18. B.value = val
  19. ListAddLast(cvars, B)
  20. End Method
  21.  
  22. Method GetCVAR:String(nam$)
  23. For Local C:CVAR = EachIn cvars
  24.         If C.name = nam
  25.                 Return C.value
  26.         EndIf
  27. Next
  28. Return "0"
  29. End Method
  30.  
  31. End Type
  32.  
  33.  
  34. Type CVAR
  35. Field name$, value$
  36. Function C:CVAR()
  37. Return New CVAR
  38. End Function
  39. End Type


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal