The time now is Wed 25 Apr 2018, 22:15
All times are UTC - 4 |
Author |
Message |
thelaptopkiller
Joined: 25 Oct 2009 Posts: 67 Location: The only place in tornado ally with no tornadoes
|
Posted: Fri 03 Dec 2010, 14:51 Post subject:
A little C++ app Subject description: For games and computer usage |
|
So I have been working on a (not so)simple little program for a few days and wanted to post it here.
It is a little timer app for a online MMOG game called Roblox.
I let some kids use my computer and don't want them to stay on for 2 hours playing it.
(Don't ask why I do it)
So far it is window$ only just because the game only works on window$.
(Pity....)
I have it set as a bat script,a launcher for that bat script and the timer/roblox launcher that fires a log off script.
Here is the code I decided on for the main launcher:
Code: | #include <iostream>
#include <windows.h>
#include <dos.h>
#include <unistd.h>
using namespace std;
int main()
{
cout << "========================================================";
cout << "\n=====================Warning!===========================";
cout << "\n======If you close this program you will log off!=======";
cout << "\n========================================================";
cout << "\n========================================================";
cout << "\n\nWaiting for internet to load...\n";
Sleep(10000);
cout << "Starting Roblox\n";
system("E:\\Roblox.exe");
cout << "\n\n\nYou have 30 minutes before I log you off.";
Sleep(3300000);
PlaySound("E:\\WINDOWS\\Media\\Windows XP Ringout.wav", NULL, SND_FILENAME|SND_LOOP);
PlaySound("E:\\WINDOWS\\Media\\Windows XP Ringout.wav", NULL, SND_FILENAME|SND_LOOP);
PlaySound("E:\\WINDOWS\\Media\\Windows XP Ringout.wav", NULL, SND_FILENAME|SND_LOOP);
PlaySound("E:\\WINDOWS\\Media\\Windows XP Ringout.wav", NULL, SND_FILENAME|SND_LOOP);
PlaySound("E:\\WINDOWS\\Media\\Windows XP Ringout.wav", NULL, SND_FILENAME|SND_LOOP);
Sleep(300000);
system("E:\\Log_off.bat");
}
|
Here is the code for the startup launcher:
Code: | #include <iostream>
#include <windows.h>
using namespace std;
int main()
{
system("E:\\Startup.bat.bat");
} |
Any comments?
At all?
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: Sun 05 Dec 2010, 02:27 Post subject:
|
|
It's pretty simple in Linux (or any *nix for that matter) using a script.
This should let you time any game - just save it as timedgame and call it like:
timedgame Roblox Code: | #!/bin/sh
echo "======================================"
echo "==================Warning!==============="
echo "======If you close this program you will log off!======="
echo "======================================"
echo "======================================"
echo
##############NOT REALLY DOING ANYTHING - SO COMMENTED
#echo "Waiting for internet to load...";
#sleep 10
##########################################
$1 &
sleep 3300
echo "You only have 5 minutes left"
aplay /usr/share/audio/2barks.wav
sleep 300
aplay /usr/share/audio/leave.wav
killall $1
|
(note that you will need to be in a terminal to see the echoes ... would be better to use Xdialog, xmessage or yaf-splash etc ... this was just an example)
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
thelaptopkiller
Joined: 25 Oct 2009 Posts: 67 Location: The only place in tornado ally with no tornadoes
|
Posted: Fri 10 Dec 2010, 18:50 Post subject:
|
|
And THAT is why I love puppy!
bash is so much easier than C++ for sure
no chance of blowing off my foot with one letter
I can't get playsound() to play for over 20 seconds though, what's with that?
if only roblox would work in wine...
TLK
|
Back to top
|
|
 |
|
|
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 You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
[ Time: 0.0472s ][ Queries: 12 (0.0199s) ][ GZIP on ] |