Re: Could I put commands in a variable

2004-02-20 Thread James Edward Gray II
On Feb 20, 2004, at 3:31 PM, Guay Jean-Sébastien wrote: On Feb 20, 2004, at 2:02 PM, Joel wrote: Thanks, can you give me some examples of loops like that? Here's one: Nice code James, nicely reusable. Just need to add world file loading and maybe support for items... ;) Thank you. I'll look forw

RE: Could I put commands in a variable

2004-02-20 Thread Guay Jean-Sébastien
> On Feb 20, 2004, at 2:02 PM, Joel wrote: >> Thanks, can you give me some examples of loops like that? >Here's one: Nice code James, nicely reusable. Just need to add world file loading and maybe support for items... ;) But then all you have is a world in which you can move. What about actual ga

Re: Could I put commands in a variable

2004-02-20 Thread James Edward Gray II
On Feb 20, 2004, at 2:02 PM, Joel wrote: Thanks, can you give me some examples of loops like that? Here's one: #!/usr/bin/perl use strict; use warnings; # build world as nested hashes my %world = ( Bridge => { Description => 'The Bridge of the spaceship...', Exits => { North => 'Quart

Re: Could I put commands in a variable

2004-02-20 Thread Daniel Staal
--As of Friday, February 20, 2004 8:35 AM -0800, R. Joseph Newton is alleged to have said: I don't know about this Daniel. Even for all its goto's, I found the original more reaable. I actually found his code quite readable, and felt I lost some of that. I felt it a tradeoff worth making at th

Re: Could I put commands in a variable

2004-02-20 Thread Joel
Thanks, can you give me some examples of loops like that? Joel - Original Message - From: "James Edward Gray II" <[EMAIL PROTECTED]> To: "Rob Dixon" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, February 20, 2004 12:36 PM Subject:

Re: Could I put commands in a variable

2004-02-20 Thread R. Joseph Newton
Joel wrote: > Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the > same really. > > Joel One thing you may find handy when you restructure is a way to organize your crises: Greetings! E:\d_drive\perlStuff>perl -w sub get_crisis { my $crisis_tag = shift; my $crises = {

RE: Could I put commands in a variable

2004-02-20 Thread Holcomb, Kevin
and no longer floats your boat, Don't waste your time with crying, just get on your back and float. -- -Original Message- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Sent: Friday, February 20, 2004 12:36 PM To: Rob Dixon Cc: [EMAIL PROTECTED] Subject: Re: Could I put co

Re: Could I put commands in a variable

2004-02-20 Thread James Edward Gray II
On Feb 20, 2004, at 5:25 AM, Rob Dixon wrote: Hi Daniel. I haven't looked at your code, but I don't think a rewrite is in the spirit of helping beginners at Perl. It may occasionally be the best answer, but I suspect you're simply enjoying yourself here ;) I wonder what others think? I have mixed

Re: Could I put commands in a variable

2004-02-20 Thread R. Joseph Newton
Joel wrote: > Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the > same really. > > Joel Looks good! I like the logic overall. I think that once you get your hands on some better syntactic tools, you will be flying right along. You have a bit of reading to do to really ge

Re: Could I put commands in a variable

2004-02-20 Thread R. Joseph Newton
Joel wrote: > Thanks. > > What does "ne" mean? It's not listed in functions in the documentation. > > Joel It's actually an operator, for inequality of strings. It's the complement of eq, the string equality operator eq. These measure strings for character-by-character equality. This is as dis

Re: Could I put commands in a variable

2004-02-20 Thread R. Joseph Newton
Daniel Staal wrote: > --As of Thursday, February 19, 2004 6:31 PM -0500, Joel is alleged to have > said: > > > Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the > > same really. > > --As for the rest, it is mine. > > Here's a first approximation of a rewrite. ;-) (Major pro

Re: Could I put commands in a variable

2004-02-20 Thread James Edward Gray II
On Feb 19, 2004, at 5:31 PM, Joel wrote: Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the same really. Joel: I've gone through and suggested some simple changes up through the first major block. You've already been given a good look at how you might rework the entire s

Re: Could I put commands in a variable

2004-02-20 Thread Rob Dixon
Paresh Jain wrote: > > On Fri, 20 Feb 2004, Joel wrote: > > > > What does "ne" mean? It's not listed in functions in the documentation. > > > > ne stands for "not equal". it is used in string matching Check out perldoc perlop Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Could I put commands in a variable

2004-02-20 Thread Randy W. Sims
On 02/20/04 09:38, James Edward Gray II wrote: On Feb 20, 2004, at 4:25 AM, Randy W. Sims wrote: On 02/19/04 23:21, James Edward Gray II wrote: On Feb 19, 2004, at 9:22 PM, R. Joseph Newton wrote: I don't know, Rob. I would be interested in hearing of any real-world problem that would demand t

Re: Could I put commands in a variable

2004-02-20 Thread James Edward Gray II
On Feb 20, 2004, at 4:25 AM, Randy W. Sims wrote: On 02/19/04 23:21, James Edward Gray II wrote: On Feb 19, 2004, at 9:22 PM, R. Joseph Newton wrote: I don't know, Rob. I would be interested in hearing of any real-world problem that would demand this. I believe the text book example is a languag

Re: Could I put commands in a variable

2004-02-20 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Randy W. Sims) writes: >One example of a legitimate use of goto from perlsub: > > Many "AUTOLOAD" routines load in a definition for the > requested subroutine using eval(), then execute that sub- > routine using a special form of goto() that

Re: Could I put commands in a variable

2004-02-20 Thread Paresh Jain
quot; <[EMAIL PROTECTED]> > To: "Perl Beginners" <[EMAIL PROTECTED]> > Sent: Thursday, February 19, 2004 9:54 PM > Subject: Re: Could I put commands in a variable > > > > --As of Thursday, February 19, 2004 6:31 PM -0500, Joel is alleged to have > > s

Re: Could I put commands in a variable

2004-02-20 Thread Joel
Thanks. What does "ne" mean? It's not listed in functions in the documentation. Joel - Original Message - From: "Daniel Staal" <[EMAIL PROTECTED]> To: "Perl Beginners" <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 9:54 PM Subject:

Re: Could I put commands in a variable

2004-02-20 Thread Daniel Staal
--As of Friday, February 20, 2004 11:25 AM +, Rob Dixon is alleged to have said: I haven't looked at your code, but I don't think a rewrite is in the spirit of helping beginners at Perl. It may occasionally be the best answer, but I suspect you're simply enjoying yourself here ;) --As for the

Re: Could I put commands in a variable

2004-02-20 Thread Rob Dixon
Daniel Staal wrote: > > --As of Thursday, February 19, 2004 6:31 PM -0500, Joel is alleged to have > said: > > > Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the > > same really. > > --As for the rest, it is mine. > > Here's a first approximation of a rewrite. ;-) (Major pr

Re: Could I put commands in a variable

2004-02-20 Thread Randy W. Sims
On 02/19/04 14:22, Joel wrote: Yes, BASIC is the only programming I have ever done. All I can really remember was PRINT, GOTO, and a variety of line numbers. I'm trying to write a text adventure You might "steal" some code from the module Games::Rezrov .

Re: Could I put commands in a variable

2004-02-20 Thread Randy W. Sims
On 02/19/04 23:21, James Edward Gray II wrote: On Feb 19, 2004, at 9:22 PM, R. Joseph Newton wrote: I don't know, Rob. I would be interested in hearing of any real-world problem that would demand this. I believe the text book example is a language that lacks support for something like Java's

RE: Could I put commands in a variable

2004-02-20 Thread David le Blanc
> > > > If I was using one specific group of commands, Could I put > them inside a > > variable, then just use the variable when I needed the > commands instead of > > copying and pasting them? > > > > i.e. > > print "Hello world"; > > if ($i == 50) { > > goto MAIN; > > } > > elsif ($t ==

RE: Could I put commands in a variable

2004-02-20 Thread David le Blanc
If you want a fantastic text adventure. try reading the perl source code. [what was that noise Jim?] > -Original Message- > From: Joel [mailto:[EMAIL PROTECTED] > Sent: Friday, 20 February 2004 6:45 AM > To: perl > Subject: Re: Could I put commands in a variable

Re: Could I put commands in a variable

2004-02-19 Thread R. Joseph Newton
Dan Muey wrote: > > For instance: > > > > > > sub launch_viewer { > > my $for_path = shift; > > $message_viewer = create_main_viewer_window(); [snip pretty code IMHO] > > > create_view_menu(); > > create_find_menu(); > > } > > > > Nice Joseph, > > If I'm looking at this right this is a G

Re: Could I put commands in a variable

2004-02-19 Thread James Edward Gray II
On Feb 19, 2004, at 9:22 PM, R. Joseph Newton wrote: I don't know, Rob. I would be interested in hearing of any real-world problem that would demand this. I believe the text book example is a language that lacks support for something like Java's "finally" block. A goto can guarantee you get to

Re: Could I put commands in a variable

2004-02-19 Thread R. Joseph Newton
Rob Dixon wrote: > IMO that's a bit strong. 'goto' will always have its place until > language authors can predict all possible flows of control that > could be wanted by a programmer. Perl is richer than most in that > it has implicit gotos last, next, redo, return and die, but it > still has no

Re: Could I put commands in a variable

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 6:31 PM -0500, Joel is alleged to have said: Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the same really. --As for the rest, it is mine. Here's a first approximation of a rewrite. ;-) (Major problem: it always asks what you want to d

Re: Could I put commands in a variable

2004-02-19 Thread Joel
Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the same really. Joel - Original Message - From: "James Edward Gray II" <[EMAIL PROTECTED]> To: "Joel" <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 3:06 PM Subject: R

RE: Could I put commands in a variable

2004-02-19 Thread Bob Showalter
Joel wrote: > Yes, BASIC is the only programming I have ever done. All I can really > remember was PRINT, GOTO, and a variety of line numbers. I'm trying > to write a text adventure (Don't look at me like that, Perl is a > general purpose language!). I'm getting tired of writing large chunks > of c

Re: Could I put commands in a variable

2004-02-19 Thread Rob Dixon
Joel wrote: > > I'll post the code tommorow. I just need to change all the room descriptions > and items, since the the characters and places depicted in the game are > copyrighted. I wrote it as a fan work. You'll find lots of support here Joel. I fondly remember playing Dungeon on a 12-bit PDP8.

Re: Could I put commands in a variable

2004-02-19 Thread Joel
t; To: "Joel" <[EMAIL PROTECTED]> Cc: "perl" <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 2:40 PM Subject: Re: Could I put commands in a variable > On Feb 19, 2004, at 1:22 PM, Joel wrote: > > > Yes, BASIC is the only programming I have ever done. All

Re: Could I put commands in a variable

2004-02-19 Thread James Edward Gray II
On Feb 19, 2004, at 1:22 PM, Joel wrote: Yes, BASIC is the only programming I have ever done. All I can really remember was PRINT, GOTO, and a variety of line numbers. Most of us were there at some point. We just don't talk about it much. :D I'm trying to write a text adventure (Don't look at

Re: Could I put commands in a variable

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 2:22 PM -0500, Joel is alleged to have said: Yes, BASIC is the only programming I have ever done. All I can really remember was PRINT, GOTO, and a variety of line numbers. I'm trying to write a text adventure (Don't look at me like that, Perl is a general purpo

Re: Could I put commands in a variable

2004-02-19 Thread Joel
hat I reuse the basic structure of and wouldn't mind an easier solution. I'll go look up subroutines, allthough GOTO does just fine for me. - Original Message - From: "Rob Dixon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004

Re: Could I put commands in a variable

2004-02-19 Thread Rob Dixon
R. Joseph Newton wrote: > > > i.e. > > print "Hello world"; > > if ($i == 50) { > > goto MAIN; > > Don't do this. For some perverse reason, goto was included in the Perl > language. This may have been to support legacy programs. No new code should > ever be written with such structures. The

RE: Could I put commands in a variable

2004-02-19 Thread Dan Muey
> For instance: > > > sub launch_viewer { > my $for_path = shift; > $message_viewer = create_main_viewer_window(); > add_main_menu($message_viewer); > add_header_list($message_viewer, $for_path); > add_message_area($message_viewer); > print get_viewer_option('Files|References'), "\n"

Re: Could I put commands in a variable

2004-02-19 Thread R. Joseph Newton
Joel wrote: > If I was using one specific group of commands, Could I put them inside a > variable, then just use the variable when I needed the commands instead of > copying and pasting them? Yes. You could do that. It would be a step backward, though. Variables are for storing data or informa

Re: Could I put commands in a variable

2004-02-19 Thread Rob Dixon
Joel wrote: > > If I was using one specific group of commands, Could I put them inside a > variable, then just use the variable when I needed the commands instead of > copying and pasting them? > > i.e. > print "Hello world"; > if ($i == 50) { > goto MAIN; > } > elsif ($t == 100) { > go