View Full Version : How to time a script
AestheticDeath
09-10-2006, 02:04 PM
Basically I am wanting my script to go and check on something every set amount of time. Like every ten minutes, or 20 or 30. Depending.
Is there a way to do this with a WizardFE script, and not using lich or psinet?
Latrinsorm
09-10-2006, 02:06 PM
pause #
where # is seconds. I don't know if there's an upper limit to it, but you could always just divide it into a series of smaller pauses if need be.
edit: Oh also you could do a set of waitfors linked to the PsiNet restmode messaging. Less flexibility there though.
AestheticDeath
09-10-2006, 02:28 PM
pause means I cant do anything in the meantime
and atm I dont use psinet or lich or anything
Mainly wondering if there is a way to match the numbers you get from the time command, if its like an even 10 20 30 etc I can make it goto a different part of the script, if not loop it back into what it was doing...
AestheticDeath
09-10-2006, 02:33 PM
Was thinking there would be way to do a matchwait or something like that for the time you get..
But then I think it would have to have an entry for all the variables which would be too many. 1440 variables I think if you had to do each one.
Is there a way to skip part of the messaging?
Like time gives you:
Today is Restday, day 10 of the month Imaerasta in the year 5106. It is 13:29 by the elven time standard. It is currently afternoon.
Is there a way to take 'It is 13:29', and have it only match on the last two numbers? If it is zero on the end goto loop2, if not goto loop1?
Artha
09-10-2006, 02:42 PM
you could do like match time :39 etc. That's super inefficient and going to be hard to make it work unless you start the script at *:10 every time you run it.
Latrinsorm
09-10-2006, 04:18 PM
I don't think it'd be too bad in Wizard. You'd have to have 60 sections of code (one for each starting minutes), then in each section have this:
23:
match tenminuteshavepassed :33
match tenminuteshavenotpassed elven time
matchwait
If you want it to be selectable by user input, you'd need to do something like:
23ten:
match tenminuteshavepassed :33
match tenminuteshavenotpassed elven time
matchwait
23twenty:
match twentyminuteshavepassed :43
match twentyminuteshavenotpassed elven time
matchwait
and so on.
Then as your script went along, you'd have regularly interspersed time checks. You'd just have to make sure you check time at least once a minute so as to not miss. The trouble is that in Wizard you'd be using up one of your variables to keep track of when the timer "started" unless you have the user input the time in minutes at the start of the script.
AestheticDeath
09-10-2006, 05:25 PM
OK, I dont need the check exactly after ten minutes of the script running, basically I just wanted periodic checks to be done. So if this part below works, the first check would occur 10 minutes or less into the script, then every ten minutes afterwards. Hopefully the checks would happen fast enough it wouldnt miss it during the minutes changing.
#time
loop:
pause 5
echo It should be about time!
pause 5
goto timecheck
timecheck:
put time
match next :00
match next :10
match next :20
match next :30
match next :40
match next :50
match next :60
match loop elven time
matchwait
next:
echo Yup its time!
match done Yup
matchwait
done:
echo DONE
exit
It finds the time alright and goes on to say Yup its time! but does not exit the script... Howd I mess up the end?
Jorddyn
09-10-2006, 06:54 PM
It finds the time alright and goes on to say Yup its time! but does not exit the script... Howd I mess up the end?
next:
echo Yup its time!
echo DONE
exit
Why not just do this?
No clue why the "Yup" doesn't match, but I'd wager it has to do with it echoing.
Jorddyn
Artha
09-10-2006, 07:40 PM
I would guess that it executes the echo before it checks for the match. So matching to the echo doesn't work.
Bobmuhthol
09-10-2006, 07:42 PM
lol.
Yeah, you can't match an echo, because match only works for data that is actually sent by Simu to the front end. That matchwait is going to cause the script to hang until something actually says "Yup."
AestheticDeath
09-10-2006, 07:43 PM
Well it was just an example... but this is the script I was trying to make. Still working on it however.
#LandingCitizenship
Main:
echo *
echo * Run this script constantly, you will get citizenship in 6 hours or less.
echo * Start this script in the landing bank
echo * Make sure you have 30,031 coins in the bank
echo *
pause
goto Bank
Bank:
put deposit all
pause
put withdraw 30000
waitfor The teller
move go arch
move out
goto Grocer
Grocer:
move w
move go shop
move w
goto Buy
Buy:
pause 3
put order 5
waitfor You may
put buy
waitfor An eager clerk takes
put eat my sand
pause 3
put eat my sand
pause 3
put eat my sand
pause 3
put eat my sand
pause 3
put eat my sand
pause 3
put eat my sand
waitfor You take a bite
goto Time
Time:
put time
match Clerk :00
match Clerk :10
match Clerk :20
match Clerk :30
match Clerk :40
match Clerk :50
match Clerk :60
match Buy elven time
matchwait
Clerk:
move e
move out
move e
move e
move e
move go hall
move go stair
move e
move e
move go maoral door
put ask clerk about citizenship
match Return You aren't qualified for citizenship yet
match Citizen Congratulations - have to dig up this message
matchwait
Return:
move out
move w
move w
move go stair
move out
move w
move w
move w
move go shop
move w
goto Buy
Citizen:
write name in book - will need to remember how to write in the book
exit
Bobmuhthol
09-10-2006, 07:45 PM
What a terrible idea.
Pause 600 before looping.
Bobmuhthol
09-10-2006, 07:46 PM
<<echo * Make sure you have 30,031 coins in the bank>>
<<put withdraw 30000>>
That's uh... not the same number.
Bobmuhthol
09-10-2006, 07:48 PM
Actually, that entire script sucks.
AestheticDeath
09-10-2006, 07:50 PM
<<echo * Make sure you have 30,031 coins in the bank>>
<<put withdraw 30000>>
That's uh... not the same number.
Go to the bank and type withdraw 30000
AestheticDeath
09-10-2006, 07:53 PM
Also this script is more of a test to see how citizenship works. Since I dont know what the actual parameters are to gain it. Its not the amount spent, as I have gotten it by spending varying amounts, and if it was amount... you could go buy a invar lockpick or three and have it.
So I am trying to figure out whether its the number of transactions etc..
Why do you say wait 10 minutes between each purchase? Are you saying you can get citizenship by just purchasing 36-40 items within 6 or so hours?
AestheticDeath
09-10-2006, 07:58 PM
Actually, that entire script sucks.
Please elaborate Your Highness. I would like to learn.
Bobmuhthol
09-10-2006, 08:23 PM
<<Why do you say wait 10 minutes between each purchase? Are you saying you can get citizenship by just purchasing 36-40 items within 6 or so hours?>>
For the same reason that you only check in with the citizenship clerk on times that end in 0.
<<Go to the bank and type withdraw 30000>>
Withdraw silvers.
<<Please elaborate Your Highness. I would like to learn.>>
The order, on top of the time matching, is, as far as I'm concerned, illogical. It doesn't flow.
AestheticDeath
09-10-2006, 08:38 PM
Thats not the same reason. I am checking in with the clerk so the script will end at some point by itself. Your just limiting the amount of items you buy in a given time frame.
I made a small loop like this:
loop:
pause 5
order 5
waitfor You may
put buy
waitfor An eager clerk takes
put eat my sand
pause 5
put eat my sand
pause 5
put eat my sand
pause 5
put eat my sand
pause 5
put eat my sand
pause 5
put eat my sand
waitfor You take a bite
goto loop
That was the whole script. I ran it overnight after I went to bed, woke up in 6 hours, and went from a brand new character to a character with citizenship. The point of expanding this script was to figure out exactly how long it takes, or how many items you must buy before getting citizenship. I hate wasting time and coins, so the best thing for me was to get citizenship as fast as possible with the least amount of coins spent.
This new script is a step toward figuring that out. As no one I have asked knew, or would tell me what it takes. And most of the citizenship scripts I see run all over the freaking town and usually tell you to run it once every four hours. I didnt feel like doing it that way.
Withdrawing silvers isnt in the script. And to hold silvers while doing this means someone can steal them. I prefer a note. So your comment on my math was pointless, as my numbers were correct.
As to the order and time matching being illogical? Not flowing? Remember what so many have said, I am stupid and dense... Explain further, smaller words. K thx
Bobmuhthol
09-10-2006, 08:44 PM
Okay, nevermind, I didn't realize you were making a script that did nothing but buy shit forever. I can't really help you with this because I would never write a script like that.
AestheticDeath
09-10-2006, 09:01 PM
The endless one served its purpose, now I am trying to streamline it, and give it an ending point. Thats why it checks the time, at certain intervals, and checks on the citizenship status. If you earned citizenship, theres no point in buying more.
If you know something about limitations on buying things to gain citizenship, that would help. Thats the only reason I can figure you would say to pause 600 and loop. Assuming I am buying too much. Did you mean to suggest there is some sort of limit? Or time variable in between purchases, that I do not know and am not considering?
I can set it to buy one item every ten minutes and check at that time without checking the time, but I did not really thing that would get me citizenship in such a short amount of time.
Bobmuhthol
09-10-2006, 09:06 PM
<<Did you mean to suggest there is some sort of limit?>>
As far as I know, there absolutely is.
<<I can set it to buy one item every ten minutes and check at that time without checking the time, but I did not really thing that would get me citizenship in such a short amount of time.>>
I don't know what the exact numbers are, unfortunately.
StrayRogue
09-10-2006, 09:55 PM
Yes there is a limit. You can't just buy billions of items very quickly to gain citizenship ultra fast.
AestheticDeath
09-10-2006, 11:14 PM
Well, I did it in 6 hours.
Now I am trying to figure out the lower limit.
hence the timer..
I will let ya know if it works, and the results.
Shaelun
09-11-2006, 02:03 AM
I used to use one of the tiny wearable hourglasses for Wizard scripts that I wanted a timer for. You can "pause" them, restart them, and they give a unique message every minute that passes and the "timer" goes off after 10 minutes have passed.
Sounds like it would work for your purposes.
AestheticDeath
09-11-2006, 07:16 AM
Thanks Shaelun, I will have to look for one of those hourglasses.
As is, this script worked last night. Beyond some testing before hand, I ran it from 9:50pm-4:50am, and had citizenship. When I check at 4:50, it had 23 instances of the rest mode entering 'exper'. I dont recall the duration of that rest time atm tho.
The final script I used had enough pause's to make it take 52+ seconds per purchase. I am going to toy with longer and shorter durations there, and see what happens.
AestheticDeath
09-16-2006, 06:28 PM
Havent had time to keep working on it, but this was the last script I used.
#lc
Main:
echo *
echo * Run this script constantly, you will get citizenship in 6-8 hours
echo * Start this script in the landing bank
echo * Make sure you have 50,031 coins in the bank
echo *
pause
goto Bank
Bank:
put deposit all
pause
put withdraw 50000
waitfor The teller
move go arch
move out
goto Grocer
Grocer:
move w
move go shop
move w
goto Buy
Buy:
pause 20
put order 5
waitfor You may
put buy
waitfor An eager clerk takes
put eat my sand
pause 20
put eat my sand
pause 20
put eat my sand
pause 20
put eat my sand
pause 20
put eat my sand
pause 20
put eat my sand
waitfor You take a bite
goto Time
Time:
put time
match Clerk :00
match Clerk :10
match Clerk :20
match Clerk :30
match Clerk :40
match Clerk :50
match Clerk :60
match Buy elven time
matchwait
Clerk:
move e
move out
move e
move e
move e
move go hall
move go stair
move e
move e
move go maoral door
put ask clerk about citizenship
match Return You aren't qualified for citizenship yet
match Citizen you do seem to be eligible for full citizenship
matchwait
Return:
move out
move w
move w
move go stair
move out
move w
move w
move w
move go shop
move w
goto Buy
Citizen:
put write book
exit
SaroAfk
09-17-2006, 02:47 AM
the obvious suggestion to this is run 2 scripts and use a global variable I havent tested this but dont see why it wouldnt work:
#################################
#script1
start_script "script2"
start:
if $crosscharcom_server == 1
$crosscharcom_server = 0
goto "go_dospecialoperation"
else
goto "sitthere"
end
goto "start"
#################################
#script2
start2:
pause durationinseconds
$crosscharcom_server = 1
goto "start2"
###########################
The variable is global, I know ebcause i've used it, if you dont want to use that one try a diff one, just becareful what you use because lich itself uses those variables, screw up the wrong one and you've broke your entire program, havent found a way to define global variables myself, if thats possible you could do that.
Shaelun
09-17-2006, 04:11 AM
You can make up any global variables you want/need -- just use them like any other variable name, but put a dollar sign in front of them.
$nobody_would_ever_bother_making_a_variable_like_t his_but_it_would_work_and_it_would_be_global
BTW, I don't remember off-hand exactly how I wrote "crosscharchom.lic" but if you change its variables then things'll probably get screwy. If they don't, I guess it's a better script than I thought, heh.
Joseph
09-17-2006, 10:26 AM
$nobody_would_ever_bother_making_a_variable_like_t his_but_it_would_work_and_it_would_be_global
I thank Shae is giving those who attempt to wirte in ruby too much credit.. a few of my variables are getting close to that in length.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.