Author Topic: Need help with program  (Read 3877 times)

0 Members and 1 Guest are viewing this topic.

Offline rcfun92

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +2/-0
    • View Profile
Need help with program
« on: April 29, 2013, 10:45:18 pm »
Hello,

So I wanted to ask my friend to prom using my calculator because we are in the same math class and I thought it would be cute. I was trying to create a program but for some reason its not working. If you can debug it that would be great:

Input,"Prom ? (Yes/No)",A
If A = "Yes"
Then
Disp "Yay!"
Else
Disp " :("
End

Thank You,
Roger

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Need help with program
« Reply #1 on: April 30, 2013, 12:28:42 am »
I'm not an expert at Basic, but I'm not sure if you can compare words/strings that easily :/

The Menu() command might be of use here.

:Menu("Prom?","Yes",1,"No",2)
:Lbl 1
:Pause "Yay!"
:Stop
:Lbl 2
:Pause "D:"
:Stop


Maybe something like that?
Good luck ;)

Edit: simplified a bit
« Last Edit: April 30, 2013, 12:54:15 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Need help with program
« Reply #2 on: April 30, 2013, 03:47:05 am »
Actually, if you just use the variable Str1 (under the vars menu) instead of A, it should work. :)  Regular variables can't store strings.
Also, the first line should be
Input "Prom ? YES/NO",Str1. The fist comma isn't needed.
 Welcome to Omni by the way, and best of luck! :D
« Last Edit: April 30, 2013, 03:51:16 am by Art_of_camelot »

Offline alex99

  • LV3 Member (Next: 100)
  • ***
  • Posts: 80
  • Rating: +9/-5
    • View Profile
    • Alexstudious
Re: Need help with program
« Reply #3 on: April 30, 2013, 04:33:46 am »
or you store bytes into the variables
Code: [Select]
1-->N
2-->o
3-->Y
4-->E
5-->S

input"prom (Yes/No),A
ifA=YES
then
...
« Last Edit: April 30, 2013, 04:35:16 am by alex99 »
VISIT:

www.atomsoftware.jimdo.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Offline rcfun92

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +2/-0
    • View Profile
Re: Need help with program
« Reply #4 on: May 01, 2013, 12:26:50 am »
Last Thing:
How can I make it sou instead of the user typing in Second Alpha it is automatically text. Thank You so much!

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Need help with program
« Reply #5 on: May 01, 2013, 06:19:03 am »
For that, you need an assembly program. For example, name the program prgmALOCK and use Asm(prgmALOCK before the Input command:
Code: [Select]
AsmPrgm3E51FD7712C9


Also, I noticed that elsewhere you said this was for a school project ?

Offline alex99

  • LV3 Member (Next: 100)
  • ***
  • Posts: 80
  • Rating: +9/-5
    • View Profile
    • Alexstudious
Re: Need help with program
« Reply #6 on: May 01, 2013, 09:44:36 am »
For that, you need an assembly program. For example, name the program prgmALOCK and use Asm(prgmALOCK before the Input command:
Code: [Select]
AsmPrgm3E51FD7712C9


Also, I noticed that elsewhere you said this was for a school project ?
well i think you must compile it with asmcompile( first, or???
if yes you can call the prgm alock1
and make this
asmcompile(prgmalock1,prgmalock)
now you hav the asm prog
VISIT:

www.atomsoftware.jimdo.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Need help with program
« Reply #7 on: May 01, 2013, 09:56:07 am »
there is no need of the asmcomp() cmd. It's just if you want to save weight
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline alex99

  • LV3 Member (Next: 100)
  • ***
  • Posts: 80
  • Rating: +9/-5
    • View Profile
    • Alexstudious
Re: Need help with program
« Reply #8 on: May 01, 2013, 11:38:53 am »
there is no need of the asmcomp() cmd. It's just if you want to save weight

yes but some calcs crashes or disp invalid whithout asmcompile(...
VISIT:

www.atomsoftware.jimdo.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Need help with program
« Reply #9 on: May 01, 2013, 12:57:49 pm »
there is no need of the asmcomp() cmd. It's just if you want to save weight

yes but some calcs crashes or disp invalid whithout asmcompile(...
It shouldn't and I've never had a problem running it uncompressed. Here is a screenshot of how it is done:

Offline Joshuasm32

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 142
  • Rating: +19/-7
    • View Profile
    • Network
Re: Need help with program
« Reply #10 on: May 01, 2013, 06:35:30 pm »
I would use inString(, so that if she says, "Yes, I would like to," it would still recognize it:

Code: [Select]
ClrHome
ASM(prgmALPHAON    //or whatever else the name of that ASM program you will use is...
Input "PROM?",Str1
If inString(Str1,"YES") or inString(Str1,"SURE") or inString(Str1,"YA") or inString(Str1,"ALRIGHT") or inString(Str1,"OK
Then
Pause "YAY! :D
Else
Pause "D:
End

This will work, even if more words are in the phrase.  And, for "YA," the words "YEAH," "YEA," "YAY," ect. will work for it.

I hope it works out for you!  :D
« Last Edit: May 01, 2013, 06:39:39 pm by codebender »
My name is Josh and I a developer at Moonzean. I enjoy Radiohead, web development, Java, and cryptograms.
Spoiler For No Surprises, by Radiohead:
A heart that's full up like a landfill
A job that slowly kills you
Bruises that won't heal

You look so tired unhappy
Bring down the government
They don't, they don't speak for us

I'll take a quiet life
A handshake of carbon monoxide

And no alarms and no surprises
No alarms and no surprises
No alarms and no surprises
Silent, silent

This is my final fit
My final bellyache

With no alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Such a pretty house
And such a pretty garden

No alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Offline alex99

  • LV3 Member (Next: 100)
  • ***
  • Posts: 80
  • Rating: +9/-5
    • View Profile
    • Alexstudious
Re: Need help with program
« Reply #11 on: May 05, 2013, 07:35:20 am »
hmm interesting
i would use this
Code: [Select]
ClrHome
ASM(prgmA    
Input "PROM?",Str1
length(str1)-->C
"yes yep "-->str5
if instring(str5,sub(str1,1,C
Then
Pause "YAY! :D
Else
Pause "D:
End
ps:never tried this
« Last Edit: May 05, 2013, 07:36:15 am by alex99 »
VISIT:

www.atomsoftware.jimdo.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Need help with program
« Reply #12 on: May 05, 2013, 09:17:04 am »
What's funny about codebender's code is that "I WOULD SAY YES, BUT I DONT LIKE YOU" would get a "YAY! :D" in response.
As an optimization, and though it wouldn't work in the same way or catch a "YES" inside a larger string:
Code: [Select]
:ClrHome
:Asm(prgmALPHA
:Input "PROM?",Str1
:not(inString("YESUREYALRIGHTOK",Str1
:Pause sub("YAY! :D:",6Ans+1,7-5Ans
But prom was yesterday, so I'm too late anyways. :P

Offline alex99

  • LV3 Member (Next: 100)
  • ***
  • Posts: 80
  • Rating: +9/-5
    • View Profile
    • Alexstudious
Re: Need help with program
« Reply #13 on: May 06, 2013, 11:35:35 am »
What's funny about codebender's code is that "I WOULD SAY YES, BUT I DONT LIKE YOU" would get a "YAY! :D" in response.
As an optimization, and though it wouldn't work in the same way or catch a "YES" inside a larger string:
Code: [Select]
:ClrHome
:Asm(prgmALPHA
:Input "PROM?",Str1
:not(inString("YESUREYALRIGHTOK",Str1
:Pause sub("YAY! :D:",6Ans+1,7-5Ans
But prom was yesterday, so I'm too late anyways. :P
cool its better than anyones
VISIT:

www.atomsoftware.jimdo.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------