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
JeanValjean
Newbie


Joined: 23 Apr 2004
Posts: 8
Location: Denmark

PostPosted: Sun May 02, 2004 2:44 am   

Time capture
 
Hello Everyone...

Now i hate to bombard you with a bunch of code... But I have this script, that I borrowed from someone who plays the same mud as me. And I was wondering if you could help me debug it, as it doesent work for me...

#CLASS {myfanwycode|time}
#VAR currentTime {17:00}
#VAR currentDay {the Moon}
#VAR currentDayNum {6}
#VAR timeVal {17}
#VAR timeAMPM {pm}
#VAR descTime {this is a test}
#VAR currentDate {28}
#VAR currentYear {711}
#VAR lstDays {the Bull|Deception|Thunder|Freedom|the Great Gods|the Sun|the Moon }
#VAR lstMonths {Winter Wolf|Frost Giant|Old Forces|Grand Struggle|Spring|Nature|Sun|Heat|Dark Shades|Long Shadows|Ancient Darkness|Great Evil}
#VAR currentMonth {Old Forces}
#VAR currentMonthNum {3}
#VAR tmpDateNum {4}
#VAR tmpDateText {Moon}
#TRIGGER {} {#tset (70)
#timer (1) {#gag 5;time} (False)} "" {manual}
#TRIGGER "timeTrap" {It is &timeVal o'clock &timeAMPM, Day of ¤tDay, ¤tMonth (%d)*, (%d) *.} {currentTime = "";currentDate = %5;currentYear = %6;#loop 1,%numitems( @lstDays) {#if @currentDay=%item( @lstDays, %i) {currentDayNum=%i}};#loop 1,%numitems( @lstMonths) {#if @currentMonth=%item( @lstMonths, %i) {currentMonthNum=%i}};#if (@timeVal=12) {#if (@timeAMPM="am") {timeVal = 0}} {#if @timeAMPM="pm" {#math timeVal ( %number( @timeVal)+12)}};#if @timeVal<10 {currentTime = %concat( "0", @timeVal, ":00")} {currentTime = %concat( @timeVal, ":00")};#t- TimeTrap} "" {disable}
#BUTTON 74 {} {#t+ TimeTrap;#gag 4;time;#wait;tmpDateText = %replace( @currentDay, "the ", "");#echo "";#echo "";#echo %ansi( white)Calendar:;#echo "";#if (@currentMonthNum=1) {tmpDateNum=12} {#math tmpDateNum @currentMonthNum-1)};#echo %ansi( yellow)%item( @lstMonths, @tmpDateNum);#echo "B D T F G S M";#loop 1,7 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%ansi( cyan, hi)"B - "%if( @tmpDateText="Bull", %ansi( white, red), %ansi( cyan))"Bull "%ansi( cyan, hi)"D - "%if( @tmpDateText="Deception", %ansi( white, red), %ansi( cyan))"Deception "%ansi( cyan, hi)"T - "%if( @tmpDateText="Thunder", %ansi( white, red), %ansi( cyan))"Thunder ";#loop 8,14 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%ansi( cyan, hi)"F - "%if( @tmpDateText="Freedom", %ansi( white, red), %ansi( cyan))"Freedom "%ansi( cyan, hi)"G - "%if( @tmpDateText="Great Gods", %ansi( white, red), %ansi( cyan))"Great Gods "%ansi( cyan, hi)"S - "%if( @tmpDateText="Sun", %ansi( white, red), %ansi( cyan))"Sun ";#loop 15,21 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%ansi( cyan, hi)"M - "%if( @tmpDateText="Moon", %ansi( white, red), %ansi( cyan))"Moon ";#loop 22,28 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo "";#echo " "%if( @currentMonth="Winter Wolf", %ansi( white, red), %ansi( cyan))"Winter Wolf (1) "%if( @currentMonth="Sun", %ansi( white, red), %ansi( cyan))"Sun (7)";#echoprompt %ansi( yellow)%item( @lstMonths, @currentMonthNum);#echo %repeat( " ", 26-%len( %item( @lstMonths, @currentMonthNum)))""%if( @currentMonth="Frost Giant", %ansi( white, red), %ansi( cyan))"Frost Giant (2) "%if( @currentMonth="Heat", %ansi( white, red), %ansi( cyan))"Heat (8)";#echo "B D T F G S M "%if( @currentMonth="Old Forces", %ansi( white, red), %ansi( cyan))"Old Forces (3) "%if( @currentMonth="Dark Shades", %ansi( white, red), %ansi( cyan))"Dark Shades (9)";#loop 1,7 {#echoprompt %if( %i=@currentDate, %ansi( white, red)%i, %ansi( cyan)%i);#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%if( @currentMonth="Grand Struggle", %ansi( white, red), %ansi( cyan))"Grand Struggle (4) "%if( @currentMonth="Long Shadows", %ansi( white, red), %ansi( cyan))"Long Shadows (10)";#loop 8,14 {#echoprompt %if( %i=@currentDate, %ansi( white, red)%i, %ansi( cyan)%i);#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%if( @currentMonth="Spring", %ansi( white, red), %ansi( cyan))"Spring (5) "%if( @currentMonth="Ancient Darkness", %ansi( white, red), %ansi( cyan))"Ancient Darkness (11)";#loop 22,28 {#echoprompt %if( %i=@currentDate, %ansi( white, red)%i, %ansi( cyan)%i);#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%if( @currentMonth="Nature", %ansi( white, red), %ansi( cyan))"Nature (6) "%if( @currentMonth="Great Evil", %ansi( white, red), %ansi( cyan))"Great Evil (12)";#echo "";#if (@currentMonthNum=12) {tmpDateNum=1} {#math tmpDateNum @currentMonthNum+1)};#echoprompt %ansi( yellow)%item( @lstMonths, @tmpDateNum);#echo "";#echo "B D T F G S M "%ansi( white)"Current Date and Time:";#loop 1,7 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo "";#loop 8,14 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%ansi( white)"Time: "%ansi( yellow)@currentTime" "%ansi( white)"Day: "%ansi( yellow)Day of @currentDay;#loop 15,21 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo " "%ansi( white)Date: %ansi( yellow)@currentDate %ansi( white) Month: %ansi( yellow)@currentMonth %ansi( white) Year: %ansi( yellow)@currentYear;#loop 22,28 {#echoprompt %ansi( cyan)%i;#echoprompt %repeat( " ", 3-%len( %i))};#echo "";#send %crlf} {} {} {} {} {CLOCK} {Size} {20} {20} {Pos} {1} {122} {} {31} {} {} "" {} {} {} {2}
#CLASS 0


And the output i get on the time command is...

It is 1 o'clock am, Day of Thunder, Grand Struggle 17th, 767 T.A.


What I really dont understand, is how the trigger uses the "¤" symbol in its pattern. Perhaps someone could help me with explaining that.

JeanV
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun May 02, 2004 4:38 am   
 
You could save us time by telling us what you expect the script to do and what it's doing that's different from what you expect.

I have no idea how the trigger uses the "¤" symbol. It's probably supposed to be a "&".
Reply with quote
JeanValjean
Newbie


Joined: 23 Apr 2004
Posts: 8
Location: Denmark

PostPosted: Sun May 02, 2004 8:56 am   
 
Hehe, that worked. What it does , is that you push the button, it runs the time command on my mud, and displays the current time in a cool calendar form. It looks really good actually.

JeanV

Btw. Thanks Lightbulb
Reply with quote
JeanValjean
Newbie


Joined: 23 Apr 2004
Posts: 8
Location: Denmark

PostPosted: Sun May 02, 2004 8:07 pm   
 
Hmm, no wait, clear my last statement, it now works...partly.

The trigger obviously fires now, but it only seems to manage to capture the time, and not the date...

The output that i get from the mud, you can see in my first post, and the output that I get from the script is as follows:

Calendar:

Frost Giant
B D T F G S M
1 2 3 4 5 6 7 B - Bull D - Deception T - Thunder
8 9 10 11 12 13 14 F - Freedom G - Great Gods S - Sun
15 16 17 18 19 20 21 M - Moon
22 23 24 25 26 27 28
Winter Wolf (1) Sun (7)
Old Forces Frost Giant (2) Heat (8)
B D T F G S M Old Forces (3) Dark Shades (9)
1 2 3 4 5 6 7 Grand Struggle (4) Long Shadows (10)
8 9 10 11 12 13 14 Spring (5) Ancient Darkness (11)
22 23 24 25 26 27 28 Nature (6) Great Evil (12)

Grand Struggle
B D T F G S M Current Date and Time:
1 2 3 4 5 6 7
8 9 10 11 12 13 14 Time: 07:00 Day: Day of the Moon
15 16 17 18 19 20 21 Date: 26 Month: Old Forces Year: 767
22 23 24 25 26 27 28


Note: In this, the time of day is alright, also the numeric date is fine... But the Day: Day of the Moon has not been captured correctly... When I fired the script it was in fact Day of the Great Gods...

JeanV
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun May 02, 2004 8:47 pm   
 
Your initial variable statements set @currentDay to the Moon.
You never change it.
Since you don't change @currentDay, your calendar display will always say it's the Day of the Moon.

Change your trigger pattern to:
It is &timeVal o'clock &timeAMPM, Day of &currentDay, &currentMonth (%d)*, (%d) *.
Reply with quote
JeanValjean
Newbie


Joined: 23 Apr 2004
Posts: 8
Location: Denmark

PostPosted: Sun May 02, 2004 9:07 pm   
 
Heyy, that works. Thank you very much LightBulb...

JeanV
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