|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Fri May 05, 2006 10:15 pm
bugging #Sub & %exec |
This trigg
Code: |
^Your brain suddenly seems smaller\.$
#Variable (Mind_Development.Boolean) {0}
#Math (Mind_Development.Lasted) {%ctime - @Mind_Development.Up_Time}
#Color bold
#Substitute {Your brain suddenly seems smaller ~(%if(@Mind_Development.Caster != "You", @Mind_Development.Caster"'s ", "")Mind Development lasted: %exec(time_representer @Mind_Development.Lasted)~).} |
Should produce nice line:
Your brain suddenly seems smaller (Mind Development lasted: 5m 23s).
But instead i either got
Your brain suddenly seems smaller.
5m 23s // and a error message from mud for sending that
or
Your brain suddenly seems smaller.
Your brain suddenly seems smaller (Mind Development lasted: 5m 23s). // and geting again error message for sending this to mud
and sometimes it works just right doing the
Your brain suddenly seems smaller (Mind Development lasted: 5m 23s).
Any ideas whats bugging? |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri May 05, 2006 11:23 pm |
Try @{Mind_Development.Caster}"'s and see if you still get problems.
|
|
_________________ Taz :) |
|
|
|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Sat May 06, 2006 9:46 pm |
didnt work.
I tried to change the coloring also to last or to first but that neither helped. |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sun May 07, 2006 1:18 pm |
Well I can't see anything else in your code that would cause problems directly which leaves "time_representer". Post the code for that and I'll see if there is anything wrong with that.
|
|
_________________ Taz :) |
|
|
|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Sun May 07, 2006 3:45 pm |
Code: |
time_representer
#If (3600 <= %1) {%if(%mod(%1/3600,3600),%mod(%1/3600,3600)h, "")%if(%mod(%1/60,60)," "%mod(%1/60,60)m, "")%if(%mod(%1,60)," "%mod(%1,60)s, "")}
#If (60 <= %1 & %1 < 3600) {%if(%mod(%1/60,60),%mod(%1/60,60)m, "")%if(%mod(%1,60)," "%mod(%1,60)s, "")}
#If (0 < %1 & %1 < 60) {%if(%mod(%1,60),%mod(%1,60)s, "")} |
If i send 61 to it, it will represent it as 1m 1s
3601 would be 1h 1s, while 3661 would come up as 1h 1m 1s
btw, if you got better idea how to display how long soemthing has been up, it would be nice. |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Mon May 08, 2006 2:56 pm |
It looks like at times that what is returned by the %exec is being treated as a command rather than as a string. I think it would be better to turn your alias into a function instead.
Code: |
#FUNCTION time_representer {%if(3600<=%1,%if(%mod(%1/3600,3600),%mod(%1/3600,3600)h, "")%if(%mod(%1/60,60)," "%mod(%1/60,60)m, "")%if(%mod(%1,60)," "%mod(%1,60)s, ""),%if(60<=%1&%1<3600,%if(%mod(%1/60,60),%mod(%1/60,60)m, "")%if(%mod(%1,60)," "%mod(%1,60)s, ""),%if(0<%1&%1<60,%if(%mod(%1,60),%mod(%1,60)s, ""))))} |
and now you can use
Code: |
...Mind Development lasted: @time_representer(@Mind_Development.Lasted)~).} |
instead. See how that goes and if it makes a difference.
|
|
_________________ Taz :) |
|
|
|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Tue May 09, 2006 2:55 am |
Seems to work.
Wonder, could i include the calcualtion for time difference in that function too so i could skip the separate math for each prot?
something along
Code: |
#FUNCTION time_representer {%if(3600<=%ctime - %1,%if(%mod((%ctime - %1)/3600,3600),%mod((%ctime - %1)/3600,3600)h, "")%if(%mod((%ctime - %1)/60,60)," "%mod((%ctime - %1)/60,60)m, "")%if(%mod(%ctime - %1,60)," "%mod(%ctime - %1,60)s, ""),%if(60<=%ctime - %1&%ctime - %1<3600,%if(%mod((%ctime - %1)/60,60),%mod((%ctime - %1)/60,60)m, "")%if(%mod(%ctime - %1,60)," "%mod(%ctime - %1,60)s, ""),%if(0<%ctime - %1&%ctime - %1<60,%if(%mod(%ctime - %1,60),%mod(%ctime - %1,60)s, ""))))} |
I would like to have the time difference from the varible im using the funktion and from %ctime to be placed in temp variable and then that temp variable used for formating it trough.
Even possible to do as command #add and #math and #var cannot be used in a funktion? or can they? |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue May 09, 2006 3:19 am |
they can, you just need to surround the entire thing in an %exec(). Not sure if that's gonna bring back the original problem, though.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Tue May 09, 2006 9:45 am |
pass the values into the function, so use @time_representer(%ctime - value)
|
|
_________________ Taz :) |
|
|
|
|
|
|
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
|
|