When I run this code I whipped up for a personal project, I get an ERR: TYP when I don't see where the error is. OS: 2.55MP patched with Unsigned to have my name in the about screen. DCS version: 7.2. Optimizations are okay also.
SourceCoder 3 (DCSSHELL) wrote:
::DCS
:"
:DelVar Str2DelVar Str1
:ClrHome
:Input "USER:",Str1
:Lbl 1
:Input Str1,Str2
:If Str2="ECHO" or Str2="echo
:Then
:Input "echo:",Str2
:Disp Str2
:End
:If Str2="ping" or Str2="PING
:Disp "nice try
:If Str2="QUADRATIC" or Str2="quadratic
:Then
:ClrHome
:Prompt A,B,C
:Disp (~B+sqrt(B^^2-4AC))/2A,(~B-sqrt(B^^2-4AC)/2A
:Pause
:End
:If Str2="BLAME" or Str2="blame
:Disp "when in doubt,","blame comic!
:If inString(Str2,"nikkybot
:Disp "make tev make it
:If Str2="exit" or Str2="exit
:Return
:If Str2="cake" or Str2="CAKE
:Disp "lies, all lies
:If Str2="CALC" or Str2="calc" or Str2="CLAC" or Str2="clac
:Then
:Input "calc:",Str3
:Disp expr(Str3
:End
:If Str2="2+2
:Disp 5
:If Str2="CEMETECH" or "cemetech
:Disp "leading the way","to the future
:If Str2="OMNIMAGA" or "omnimaga
:Disp "lobsters
:If Str2="FLOOD" or Str2="flood
:Then
:For(A,0,4
:Disp "CEMETECHOMNIMAGA
:Disp "OMNIMAGACEMETECH
:End
:End
:Goto 1

Code:

:If Str2="CEMETECH" or "cemetech
:If Str2="OMNIMAGA" or "omnimaga


I don't think those are valid if statements
They aren't; you need the Str2= part both times. Your code would be significantly smaller if you had a piece of code at the beginning that converted all of your "commands" to uppercase, unless you'd prefer that didn't happen.
And now I feel dumb. Thanks for solving that for me. I guess someone else needed to take a stab at the code.
Kerm: I'll do that later, maybe. My current goal is to make all the commands, then optimize.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement