This One's Fer Sure (dicedpear) wrote in perl,
This One's Fer Sure
dicedpear
perl

Text Game Questions

Hey,

I'm creating a text game, basically a choose-your-own adventure, for my Intro to Unix class. I have some basic questions that I desperately need answered to even begin creating this game. I was told to try using Perl. What are your thoughts on this?


QUESTIONS

FIRST
1) How do you prompt the user to input something?
2) how do you create the places you "GoTo" (below: yesapple or noapple. do these need $ in front of them?)
3) I need something similar to a GoTo command. For example, something that looks like:

Input "Would you like to take the apple (y/n)?"
If "y"
Then GoTo yesapple
Elif GoTo noapple
Else Echo "Wrong key"
Fi

I also found this:
http://www.unix.com/shell-programming-scripting/16577-unix-v ersion-gosub-goto.html


SECOND
How would I randomly generate a number from 1-24?
This is what I found:

j=1+(int)(10.0*rand()/(RAND_MAX+1.0));

Correct?



Misc Questions:
1) is Unix case sensitive?
2) is what I'm trying to do still Unix? Or is it Linux?

Thanks, sorry if this is confusing.

Is this the right place to post these questions?
  • Post a new comment

    Error

    default userpic
  • 12 comments