Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Storing/retrieving data from a notepad
|
Storing/retrieving data from a notepad
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Stratus
(25 posts) Bio
|
| Date
| Sat 04 Jan 2003 08:33 PM (UTC) |
| Message
| Ok, I've been trying to make a poll.
Trigger: (*: Poll.
Enabled: Checked
Ignore Case: Checked
Label/Script: Poll
sub Poll (thename, theoutput, thewildcards)
dim Name
Name = world.gettriggerinfo (thename, 101)
world.send """Well hello there, " + Name + ". Todays poll is: Who will win the Steelers VS. Browns game?"
world.enabletrigger "Vote", TRUE
end sub
Trigger: (*: Vote: *
Ignore Case: Checked
Label/Script: Vote
sub Vote (thename, theoutput, thewildcards)
dim Name
dim Vote
dim Vote2
dim fVote
Name = world.gettriggerinfo (thename, 101)
Vote = world.gettriggerinfo (thename, 110)
Vote2 = LCASE(Vote)
fVote = RIGHT(Vote2, 9)
if fVote = "steelers." then
world.send """Your vote has been registered as the Steelers. #SA"
elseif fVote = ": browns." then
world.send """Your vote has been registered as the Browns. #SA"
else
world.send """Error: Vote did not register. Please try again."
end if
world.enabletrigger "Vote", FALSE
end sub
Now, the whole thing works fine. But I need to know how to save the persons vote into a text file and how to retrieve it. Also I was wondering if there was a way I could add them in the notepad so it would give me the total votes for each team. |
Trust me, Diet Coke isn't nearly as good as regular.
-Stratus | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 05 Jan 2003 09:47 PM (UTC) |
| Message
| I would put the whole lot in a plugin, put the votes into variables, and save the plugin's state. That would keep the responses over different sessions. eg.
world.setvariable "vote_" & person, team
where "person" is the person voting and "team" is who they vote for.
Then you could use "getvariablelist" to get all variables, find the ones starting with "vote_" and add to a counter for each team. then send to the notepad the totals (or do a world.note).
Alternatively you could use a database to store the results, there are a couple of example plugins that show how to write to a database and get the results back. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
11,043 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top