Your mail is here

BlitzPlus Forums/BlitzPlus Beginners Area/Your mail is here

Your Friendly Neighborhood Geek(Posted 2008) [#1]
Function command()

Command$=Input$("/cmd>")
If Command$="notify" Then
cmd=1
EndIf
If Command$="Notify" Then
cmd=1
EndIf
If Command$="NOTIFY" Then
cmd=1
EndIf
If Not cmd=1 Then
Print"Command Not Recognized."
command()
End If

End Function

Function notifyc()
Print("Notify What?")
Delay 500
queryn$=Input$("/cmd/query> ")
Delay 500
Notify queryn$
End Function

;----Program----
Print("OS by Paul")
Print("User Login")
n1$=Input$("First Name: ")
n2$=Input$("Last Name: ")
Delay 700
Print("Authenticating...")
Delay 1000
Print("Welcome, "+ n1$)
Delay 500
Print("--------------------")
Print("Logged In as:")
Print("::"+ n1$ + " " + n2$ + "::")
Print("--------------------")



While Not KeyHit(1)
Repeat
command()
Until cmd=1
notifyc()

Wend
End

;-----------------------
that code back there is
giving me a big problem.
I am trying to create a
DOS-style text based
command interface
and I cannot organize
it correctly.
How would one go about
doing this?


GfK(Posted 2008) [#2]
First bit of your code is inefficient. Its better to convert the input into lower case then you don't have to worry about users typing in capitals.

Also, your Command() function is calling itself if the user types anything other than "notify". Using recursion like that is setting you up for a stack overflow.

Repeat
  Command$=Lower(Input$("/cmd>"))
  Parse(Command$)
Forever

Function Parse(txt$)
  Select txt$
    Case "notify"
      cmd=1
    Default
      RuntimeError("Command not recognised")
  End Select
End Function



Your Friendly Neighborhood Geek(Posted 2008) [#3]
whoa, dude thanks.
now I know how to do window-based programs
and parser-based ones. You are a total lifesaver.
Just another question: i am trying to access those
cool symbols that the console font used in the old
days to make false text based graphics, such as charts
out of block symbols. I don't know how to find these symbols character code, do you know where to find the default blitzcc/console/DOS font?


GfK(Posted 2008) [#4]
For the font, you could try 'FixedSys' or 'Terminal'. Or any other fixed width font.

For the symbols, you'll be wanting an extended ASCII chart


Your Friendly Neighborhood Geek(Posted 2008) [#5]
GfK, what code (i think its Chr($) or something) would you use to input the extended ASCII on that chart? and what would you use, the hexidecimal or the other code?

P.S. what is the console equivalent of Cls?
and how do you apply a font w/o going into
graphics mode?


Vic 3 Babes(Posted 2008) [#6]
Yes - type chr$() with the decimal value in the brackets. You might be able to use hex - never tried it - because the decimal values are alongside the characters, so converting to hex would be unnecessary.


Your Friendly Neighborhood Geek(Posted 2008) [#7]
‚¨‚«‚Ç‚«
(O KI DO KI)
OKEE DOKEE!


Your Friendly Neighborhood Geek(Posted 2008) [#8]
I thought those japanese letters would come out correctly back there... now its just another cruel joke that the web has played on me... |'(


Ked(Posted 2008) [#9]
Off Topic:
@Your Friendly Neighborhood Geek:
I'm not sure I like your signature.


Your Friendly Neighborhood Geek(Posted 2008) [#10]
How is being a geek a [i]bad[i] thing...

P.S.
i did some code
;----------------------------------------------------------
doyou$=Input$("What do you want the title at the top to be? (Max 20 characters): ")

spaces=20-Len(doyou$)
spaces/2=spacesleft
Print spacesleft
;----------------------------------------------------------
to center some text, and when i use / for a division
symbol, it says "expecting end-of-file". Am I using the wrong symbol?


Ked(Posted 2008) [#11]
How is being a geek a [i]bad[i] thing...

That's not it. You are calling people geeks. That's the bad thing.


Your Friendly Neighborhood Geek(Posted 2008) [#12]
s'rry. I guess i need a life.