View Full Version : In Need of a Script
fEaRdArEaPeR
07-11-2005, 07:27 PM
Aight ppl i am in search of a script which will be helping in my work alot. ;)
i need a script, which can read one file and detect changes in it.
eg: like i want to track the gain/loss of castles in a game.
Rank Name Castle Land Kingdom Strength Race
1 Maximus Decimus Meridius(Roman Empire, Lithar 22) 2 133 3175 Orc
2 fEaRdArEaPeR(Kokanee, Lithar 32) 3 120 3148 Gnome
3 A cup(Tea, Lithar 5) 2 133 2923 Gnome
4 Le SigNagE(Xanthomatosis, Lithar 34) 5 69 2569 Orc
5 Diehard(Molsen Canadian, Lithar 32) 1 102 2543 Gnome
6 DoYouHaveALittleGnomeInU?(WouldYouLikeToo?, Lithar 18) 3 102 2479 Gnome
7 Lord Valcer(Aesry, Lithar 27) 1 83 2362 Human
8 Jorgie(Corona Lite, Lithar 32) 5 75 2330 Orc
i paste this rankings in a file. then after an hour when the kingdoms update i copy paste em again on the same file, i want a program which can compare both the lists and tell me if anyone has gained or lost castles and land.
i know i can t explain myself very nicely but if u can help me it would be greatly appreciated.
~fEaR
Aradon
07-11-2005, 07:55 PM
Well I see two ways to do this..
The old fashion way, (using the cmp or diff command in unix)
However if the rankings change this could become hard to keep track of..
So Instead I would first take in all input from the files (open), split the date (split) into hashes and then do a comparision, first with names, then grabbing the castles/land and then taking the difference and doing whatever you want with it.
At least..if I"m reading that right, that's what you want to do..
Then again, there is probably a fancy regex way to do it..and as everyone knows here, that's not my cup of tea..
If you've already got a perl script set up, just post it and let us see it :P
fEaRdArEaPeR
07-11-2005, 08:11 PM
Thats the problem.
I know nutthin abt coding. i would love if anyone can make me a script. and yeah i want that castle thingy done in the script
fEaRdArEaPeR
07-11-2005, 09:20 PM
as simply as i can put it.
if i paste the hall of fame in a file. the program shud compare the two and let me know of any changes
netroact
07-12-2005, 01:38 AM
Do you know what language the game is in? Is the information you are pasting on a web page somewhere? If the information is stored someplace, or displayed on a web page, you might not need to paste it. I assume you are just pasting this stuff in text files.
mlseim
07-12-2005, 02:35 AM
Yea,
Give us a link to the page where it's at and also a name of a text file
that you are pasting to.
There's some other important things that might help out.
Example, does your webhost allow SSI (Server Side Includes)?
Are you going to update the thing manually, or would you like it
to update every time the page is displayed?
Give us a few more things to look at.
fEaRdArEaPeR
07-12-2005, 07:36 AM
well the page is from a game, which is coded in both cgi and php.
http://strategy.thardferr.com/cgi-bin/game/hall.cgi
this is the link to the page i want to keep a check on.
but you require a username and password to login to the site.
Hope this helps a lil.
fEaRdArEaPeR
07-12-2005, 07:40 AM
Making it more clear.
Rank Name Castle Land Kingdom Strength Race
1 Maximus Decimus Meridius(Roman Empire, Lithar 22) 2 133 3175 Orc
Rank: 1
leaderName:Maximus Decimus Meridius
kingdomname:Roman Empire
Province:Lithar 22
No. of castles:2
Land:133
Strength:3175
Race: orc
joeframbach
07-12-2005, 03:50 PM
ah... good times were had with those online games.
i remember playing kingsofchaos and outwar. i made 7 or 8 little bookmarklets back in the days of outwar, auto-attackers, list sorters, link-clickers...
of course, that was all javascript. client-side scripting was better for those tasks.
i'm assuming that you don't own the game. wouldn't this be considered cheating?
anyway, here's a push in the right direction:
/(\d+) ([\w ]+)\(([\w ]+), ([\w ]+) (\d+)\) (\d+) (\d+) (\d+) (\w+)/
fEaRdArEaPeR
07-12-2005, 04:12 PM
lol. you seem to be my kind of a guy.
i'd like to get in touch with you abt those auto checkers. :)
i believe the code you just posted is from a win program. im a lil new to this so any further explanation would help alot.
joeframbach
07-12-2005, 04:57 PM
oh not that again. i quit those silly games. they just don't do anything for you. after i got to college, i think "hey, will i learn anything if i do ..." and those kinds of games just don't do it for me.
the code i posted is a regular expression that should match a record in your list.
fEaRdArEaPeR
07-12-2005, 05:04 PM
but how to use it?
joeframbach
07-12-2005, 09:12 PM
when you figure that out, that's when the magic happens.
pick up a perl book. i went to the local half price book store and found Larry Wall's "Programming Perl" for $5. it's a good read for 4 or 5 lazy afternoons after work :) a much better use of your time than running around a castle looking for gold coins or whatnot.
fEaRdArEaPeR
07-12-2005, 09:17 PM
aww... please help me... i dont wanna read. :)
FishMonger
07-12-2005, 09:57 PM
If you don't want to lift a finger and learn, then you should direct you needs to www.rentacoder.com
joeframbach
07-13-2005, 02:54 AM
hmm. i've never actually been to rentacoder.com
i guess these little things keep the world spinning.
GenShadow
07-19-2005, 02:18 AM
fEaRdArEaPeR is not a coder, but since a few people that play Thardferr are, he feels the need to gain the same advantage as them.
To answer a few questions, in the off chance anyone cares, the game is written in PHP, Perl, and C; the server does not have support for SSI.
Fear, RTFM. (I'm sure someone can explain that to you).
If you want to do this, the best way is to do it yourself, as the layout of the information won't always stay the same.
joeframbach
07-19-2005, 04:16 AM
Fear, RTFM.
can't say i didn't try...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.