Code archives/Miscellaneous/Another Console

This code has been declared by its author to be Public Domain code.

Download source code

Another Console by neos3002009
This is a very simple console. This doesn't display your console, only stores it. To display your console use this:
For str$ = EachIn Console.Text
'Do your display stuff here
Next


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


To set and retrive cvars:
'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.
Type TConsole
Field Text:TList
Field cvars:TList

Method cPrint(msg$)
ListAddLast(Text, msg$)
End Method

Method RegisterCVAR(cvar$, val$)
For Local C:CVAR = EachIn cvars
	If C.name = cvar
		C.value = val
		Return 1
	EndIf
Next
Local B:CVAR
B.name = cvar
B.value = val
ListAddLast(cvars, B)
End Method

Method GetCVAR:String(nam$)
For Local C:CVAR = EachIn cvars
	If C.name = nam
		Return C.value
	EndIf
Next
Return "0"
End Method

End Type


Type CVAR
Field name$, value$
Function C:CVAR()
Return New CVAR
End Function
End Type

Comments

None.

Code Archives Forum