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
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Mon Jun 02, 2003 11:10 pm   

DragonRealms Time/Weather window
 
I'm trying to create a window that will display the time and weather a la eScape. The information is contained in a 10-digit decimal string. As far as I can tell, the first 4 (5?)digits dictate where the sun is in the sky, the next 3 (2?) digits tell the time of day, and the final 3 digits dictate the current weather. My current problem is seperating those digits into 3 different variables to work with.

In short, how do I take a 10-digit string and split it into 3 seperate strings?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jun 02, 2003 11:58 pm   
 
quote:

I'm trying to create a window that will display the time and weather a la eScape. The information is contained in a 10-digit decimal string. As far as I can tell, the first 4 (5?)digits dictate where the sun is in the sky, the next 3 (2?) digits tell the time of day, and the final 3 digits dictate the current weather. My current problem is seperating those digits into 3 different variables to work with.

In short, how do I take a 10-digit string and split it into 3 seperate strings?



How do you get the string? If you get sent a simple line of text, you can use &# to specify a fixed-length pattern of characters to match where # = some number (ie, &4).

li'l shmoe of Dragon's Gate MUD
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Tue Jun 03, 2003 12:15 am   
 
quote:

quote:

I'm trying to create a window that will display the time and weather a la eScape. The information is contained in a 10-digit decimal string. As far as I can tell, the first 4 (5?)digits dictate where the sun is in the sky, the next 3 (2?) digits tell the time of day, and the final 3 digits dictate the current weather. My current problem is seperating those digits into 3 different variables to work with.

In short, how do I take a 10-digit string and split it into 3 seperate strings?



How do you get the string? If you get sent a simple line of text, you can use &# to specify a fixed-length pattern of characters to match where # = some number (ie, &4).

li'l shmoe of Dragon's Gate MUD


I have a first trigger to recognize that the %gsl(w) has changed, which simply echos %gsl(w), which includes some MXP tags, one of which is the 10-digit string. The second trigger matches the gsl code, and extrapolates the 10-digit string and saves it as the variable @weathercode.

Tell me a bit more how this &# works. I can't find it in the docs.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jun 03, 2003 12:22 pm   
 
Is in the help entry named Pattern Matching. You should be able to reach it easily from Introduction to Triggers.

If you can't get that to work, you might also want to look into %copy. This function returns a portion of a string starting at a specified character and retriving a specified amount of characters.

Kjata
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Tue Jun 03, 2003 9:29 pm   
 
quote:
you might also want to look into %copy. This function returns a portion of a string starting at a specified character and retriving a specified amount of characters.

Kjata



This is exactly what I was looking for. Thanks.
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