Shattered Kingdoms

Where Roleplay and Tactics Collide
VOTE NOW!
It is currently Fri Dec 27, 2024 12:29 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: (zMud) Vote Reminder - By Boo
PostPosted: Fri May 07, 2010 7:09 am 
Offline
Mortal

Joined: Thu Feb 28, 2002 4:00 pm
Posts: 677
Location: The great white north
Code:
#CLASS {VoteReminder}
#VAR lastVote {22-9-2003-17-31-46}
#ONINPUT {who} {
  #mss {"function timeToVote(lastVote) { lastVote = lastVote.split('-'); now = new Date; lastVote = new Date(lastVote[2], (lastVote[1]-1), lastVote[0], lastVote[3], lastVote[4], lastVote[5]); nextVote = new Date(lastVote); nextVote.setHours( nextVote.getHours() + 12); retVal = (nextVote < now) ? 1 : 0; return retVal;}"} {javascript}
  #mss {"function votedAt() {now = new Date; retVal = now.getDate() + '-' + (now.getMonth()+1) + '-' + now.getYear() + '-'; retVal += now.getHours() + '-' + now.getMinutes() + '-' + now.getSeconds(); return retVal; }"} {javascript}
  #if (%mss( %concat( "timeToVote('", @lastVote, "')"))) {
 #yesno {You can vote on topmudsites, do you wish to vote now?} {
      Yes: lastVote = %mss( "votedAt()")
      #url {"http://www.topmudsites.com/cgi-bin/topmuds/rankem.cgi?id=dulrik"}
      } {No:}
    }
  #mss {}
  } "" {notrig}
#CLASS 0


This code snippet will be in SkBase v1.3, but I thought I'd post it here too in case you just want to use it in your Zmud script.

It uses embedded javascript in the Zmud script (because Zmud can't handle dates and times well) and everytime you type 'who'
it checks if it's more than 12 hours since your last vote on topmudsites. It is time/date based so it ensures you are prompted to vote
every 12 hours.

After 12 hours has expired, a prompt pops up, clicking Yes (you want to vote) redirects you to the URL to vote for SK and updates
the 'lastVote' variable to the current date and time , clicking No does not update the variable (which means you get reminded
until you vote :P)

Hope this is useful to you.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 7 guests


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

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group