Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
freak[boy]
Newbie


Joined: 27 Oct 2004
Posts: 3

PostPosted: Wed Oct 27, 2004 7:49 am   

Program help
 
I've tried to do this myself, but have failed miserably.. so perhaps someone else can help me?

I want to set up something which will search the mud for 'bank accounts', using an increment.

There are three lines which I would need it to trigger on.

"Damn! You cant find that account! Maybe its not there..." would add 1 to whatever variable would be used and start the hack on the next account.

"You steal 142814 credits from the account!" or some other amount of credits. idealy, it would be neat it if would record the account hacked, then add 1 to the variable and hack again.

"Damnit! Theres almost nothing in this account!" would hopefully do the same as the above.

it would be neat if i could open up this record, from a txt file or something.

also, though this is not necessary, it would be cool if the program could search this record and exclude the accounts that i got credits from or that there was nothing in the account.
the accounts only range from 00000 - 99999.

the syntax is hack #####.

can anyone please help me with this?
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Wed Oct 27, 2004 7:00 pm   
 
Try this Autohack program. You supply the starting account and ending account via the command line. I didn't know if accounts containing only 1 digit must be preceded with 0s or not, so I made it add on the 0s, ie, hacking account 1 will put Hack 00001.
I also included a command to display your hacking history, if you should wish to check it, as well as totals on number of accounts hacked and credits gained.

Usage: HackHistory
Usage: Autohack <start account> <end account>.

Code:

#alias HackHistory {TotalHacked=%null;#loopdb @AccountsHacked {#if (%val=0) {#ECHO You hacked account #%key but it was empty.} {#ECHO You hacked account #%key and gained %val.};#add TotalHacked %val};#ECHO You have hacked a total of @TotalHacked credits from %numkeys(@accountshacked) accounts.}
#alias AutoHack {#var CurrAccount %1;#var EndAccount %2;#T+ AutoHack;NextHack}
#class AutoHack {disable}
#alias NextHack {#add CurrAccount 1;#if (@CurrAccount<@EndAccount) {#if (%iskey( @AccountsHacked, %replace(%format("&5.0n",@CurrAccount)," ",0))) {NextHack} {hack %replace(%format("&5.0n",@CurrAccount)," ",0)}} {#T- AutoHack}}
#trigger {Damn! You cant find that account! Maybe its not there...} {NextHack}
#trigger {You steal (%d) credits from the account!} {#addkey AccountsHacked {%replace(%format("&5.0n",@CurrAccount)," ",0)=%1};NextHack}
#trigger {Damnit! Theres almost nothing in this account!} {#addkey AccountsHacked {%replace(%format("&5.0n",@CurrAccount)," ",0)=0};NextHack}
#class 0
Reply with quote
freak[boy]
Newbie


Joined: 27 Oct 2004
Posts: 3

PostPosted: Thu Oct 28, 2004 12:02 am   
 
Thank you. :) It works, except for the formatting of the accounts. instead of say 10000 it'll input 10,000 which seems to confuse the mud about the account.
Is there a way to have it input the number without that formatting?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Oct 28, 2004 12:19 am   
 
Sure change the format type for all occurences of "%format("&5.0n",@CurrAccount)". Read the help and play with it a little to determine the best type to use.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
freak[boy]
Newbie


Joined: 27 Oct 2004
Posts: 3

PostPosted: Thu Oct 28, 2004 3:54 am   
 
thanks
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Thu Oct 28, 2004 5:49 am   
 
Hmm, why is it that %format cannot treat numbers as strings? That sucks. Here's the only fix i could find, freakboy:

Code:

#alias HackHistory {TotalHacked=%null;#loopdb @AccountsHacked {#if (%val=0) {#ECHO You hacked account #%key but it was empty.} {#ECHO You hacked account #%key and gained %val.};#add TotalHacked %val};#ECHO You have hacked a total of @TotalHacked credits from %numkeys(@accountshacked) accounts.}
#alias AutoHack {#var CurrAccount %1;#var EndAccount %2;#T+ AutoHack;NextHack}
#class AutoHack {disable}
#alias NextHack {#add CurrAccount 1;#if (@CurrAccount<@EndAccount) {#if (%iskey( @AccountsHacked, %replace(%replace(%format("&5.0n",@CurrAccount)," ",0),",",""))) {NextHack} {hack %replace(%replace(%format("&5.0n",@CurrAccount)," ",0),",","")}} {#T- AutoHack}}
#trigger {Damn! You cant find that account! Maybe its not there...} {NextHack}
#trigger {You steal (%d) credits from the account!} {#addkey AccountsHacked {%replace(%replace(%format("&5.0n",@CurrAccount)," ",0),",","")=%1};NextHack}
#trigger {Damnit! Theres almost nothing in this account!} {#addkey AccountsHacked {%replace(%replace(%format("&5.0n",@CurrAccount)," ",0),",","")=0};NextHack}
#class 0
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Oct 28, 2004 11:51 am   
 
Actually Danlo you can use floating point to achieve this :P %format("&5.0f",@CurrAccount)
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Thu Oct 28, 2004 3:58 pm   
 
ah thanks nexela, once again I've overlooked the obvious.
*slap self*
Gotta test more thoroughly next time.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Oct 28, 2004 8:50 pm   
 
Blah I have the same problem sometimes to, write out this long complicated thing and someone comes in behind me x=y :P
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net