|
krohnu Beginner
Joined: 09 Mar 2003 Posts: 28
|
Posted: Thu Sep 21, 2006 8:28 pm
Using the Connection timmer |
I would like to use the connection timer to help calculate how much exp/hour i can getting. is that information stored in a var or is there a way to capture that info for use with triggers?
Thanks |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Sep 21, 2006 8:52 pm |
Modify as you need it to work:
#CLASS {Char Status} {enable}
#ALIAS statversion {#SAY Char-Status: Version 1.2}
#ALIAS lvlt {
lvltimenew=%time( dd|hh|mm|ss)
lvltimeday=%eval( %word( @lvltimenew, 1, "|")-%word( @lvltimeold, 1, "|"))
lvltimehour=%eval( %word( @lvltimenew, 2, "|")-%word( @lvltimeold, 2, "|"))
lvltimemin=%eval( %word( @lvltimenew, 3, "|")-%word( @lvltimeold, 3, "|"))
lvltimesec=%eval( %word( @lvltimenew, 4, "|")-%word( @lvltimeold, 4, "|"))
#IF (@lvltimesec<0) {
#MATH lvltimemin (@lvltimemin-1)
#MATH lvltimesec (60-%abs( @lvltimesec))
}
#IF (@lvltimemin<0) {
#MATH lvltimehour (@lvltimehour-1)
#MATH lvltimemin (60-%abs( @lvltimemin))
}
#IF (@lvltimehour<0) {
#MATH lvltimeday (@lvltimeday-1)
#MATH lvltimehour (24-%abs( @lvltimehour))
}
#IF (@lvltimeday<0) {lvltimeday=0}
gt ~@GTime since last level~@R: ~@w@lvltimeday~@Rd ~@w@lvltimehour~@Rh ~@w@lvltimemin~@Rm ~@w@lvltimesec~@Rs~@w
}
#ALIAS lvltime {
lvltimenew=%time( dd|hh|mm|ss)
lvltimeday=%eval( %word( @lvltimenew, 1, "|")-%word( @lvltimeold, 1, "|"))
lvltimehour=%eval( %word( @lvltimenew, 2, "|")-%word( @lvltimeold, 2, "|"))
lvltimemin=%eval( %word( @lvltimenew, 3, "|")-%word( @lvltimeold, 3, "|"))
lvltimesec=%eval( %word( @lvltimenew, 4, "|")-%word( @lvltimeold, 4, "|"))
lvltimeold=@lvltimenew
#IF (@lvltimesec<0) {
#MATH lvltimemin (@lvltimemin-1)
#MATH lvltimesec (60-%abs( @lvltimesec))
}
#IF (@lvltimemin<0) {
#MATH lvltimehour (@lvltimehour-1)
#MATH lvltimemin (60-%abs( @lvltimemin))
}
#IF (@lvltimehour<0) {
#MATH lvltimeday (@lvltimeday-1)
#MATH lvltimehour (24-%abs( @lvltimehour))
}
#IF (@lvltimeday<0) {lvltimeday=0}
gt ~@GLast level~@R: ~@w@lvltimeday~@Rd ~@w@lvltimehour~@Rh ~@w@lvltimemin~@Rm ~@w@lvltimesec~@Rs~@w
}
#ALIAS exph {gt ~@GSo far this hour~@R: ~@w@expperhour~@RXP ~@w@cashperhour~@R$$~@w}
#ALIAS exphour {
#SEND {gt ~@GLast hour~@R: ~@w@expperhour~@RXP ~@w@cashperhour~@R$~@w}
expperhour="0"
cashperhour="0"
}
#VAR expperhour {0}
#VAR cashperhour {0}
#VAR lvltimeold {13|11|14|17}
#VAR lvltimenew {13|11|14|17}
#VAR lvltimeday {0}
#VAR lvltimehour {1}
#VAR lvltimemin {25}
#VAR lvltimesec {9}
#REGEX {^You receive (%d) bonus experience} {#ADD expperhour %1}
#TRIGGER {^You receive (%d) gold} {#ADD cashperhour %1}
#TRIGGER {^You get (%d) gold coins} {#ADD cashperhour %1}
#TRIGGER {^You raise a level!!} {
lvltime
#ADD current_level 1
}
#TRIGGER {^Congratulations hero. You have increased your powers!} {lvltime}
#ALARM "Alarm0" {*:00:00} {#IF ((@expperhour > 0) or (@cashperhour > 0)) {exphour} {}}
#TRIGGER {^You receive (*) experience points.} {
#IF (@doubleexp=1) {
#MATH testingExp %1*2
#MATH expperhour %1*2
} {
#VARIABLE testingExp {%1}
#ADD expperhour %eval( %1)
}
#MATH testingTnl (@testingEXPTNL/@testingExp)
}
#CLASS 0
Used Pretty Print
Syntax Colourizer |
|
|
|
krohnu Beginner
Joined: 09 Mar 2003 Posts: 28
|
Posted: Thu Sep 21, 2006 9:20 pm |
wow, thats not the answer i was looking for, but that sure is the current project I am working on. Thanks.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Sep 21, 2006 11:27 pm |
To answer the question directly, the connection timer is stored in a system variable named %ctime. The particulars of that variable are that:
1)%ctime is stored in seconds.
2)when you first open the character window (the main window where all the mud text is displayed, plus all your child windows) but don't connect to the mud, %ctime = 0.
3)when you connect, %ctime is first initialized to 0 and then increments by 1 every second until you disconnect.
4)if you disconnect from the mud but don't close the character, %ctime retains the current amount of time you were connected (ie, %ctime = 459385) |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Fri Sep 22, 2006 11:07 am |
Matt,
Quick question.
Is there a way to reset %ctime without closing the character? |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Fri Sep 22, 2006 11:11 am |
krohnu,
Sorry about something in my script. It doesn't use the connection timer, but an hourly timer. hourly as in the time it says on your computer. so if it's 11:59 expect it to go off in a minute. of course if it's 11:59 and your computer time says it's 11:45 expect it to go off in 15 minutes. So if you connect at 11:59 get a kill in the one minute it will report. (no report unless there's been an exp or gold gain (got no exp but got gold)
Sorry about that. I posted without 1st thinking of what you really asked for.
I think that it's modifiable to work with the %ctime but i'm unsure how to trigger on it. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Sep 22, 2006 11:16 pm |
Quote: |
Is there a way to reset %ctime without closing the character?
|
yes, just log off from the game (ie, issue the quit command) and then log back in. That resets the %ctime variable, if I'm not mistaken. Beyond this, you could try #RESET but I'm thinking that won't touch any of the system variables. System variables are set to be read-only, so setting them directly is completely out of the question unless there's an indirect reference set up via a function. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|
|
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
|
|