Glivter has asked for the wisdom of the Perl Monks concerning the following question:
Hi Guys, Im writing a "Simple" text game in perl for learning purpose.
I have this problem. I want to create a timer that can do some background stuff like adding player hp / mana / anything but im not sure how to create it at this moment and don't know if this is the right part of code to execute subroutine for that. And main problem is that Heartbeat is execute only once.
This is the code snipped for reading player input.
The Heartbeat subroutine is at this moment dummy.. Its my first time here so sorry if i write the question wrong ;)while (1) { Engine::doHeatbeat; chomp (my $input = <STDIN>); # Trim right / left white character $input =~ s/^\s+|\s+$//g; given ($input) { Engine::Parser::Command($input); } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Infinite LOOP and reading from STDIN
by hippo (Bishop) on Aug 13, 2019 at 12:55 UTC | |
by Glivter (Initiate) on Aug 13, 2019 at 13:05 UTC | |
by hippo (Bishop) on Aug 13, 2019 at 13:18 UTC | |
by AnomalousMonk (Archbishop) on Aug 13, 2019 at 20:24 UTC | |
by haukex (Archbishop) on Aug 13, 2019 at 19:30 UTC | |
Re: Infinite LOOP and reading from STDIN
by tybalt89 (Monsignor) on Aug 13, 2019 at 14:33 UTC | |
Re: Infinite LOOP and reading from STDIN
by BillKSmith (Monsignor) on Aug 13, 2019 at 13:43 UTC | |
Re: Infinite LOOP and reading from STDIN
by Theodore (Friar) on Aug 14, 2019 at 07:55 UTC | |
Re: Infinite LOOP and reading from STDIN
by jcb (Parson) on Aug 14, 2019 at 01:46 UTC |
Back to
Seekers of Perl Wisdom