Raised This Month: $32 Target: $400
 8% 

TF2 Vote Usermessages


Post New Thread Reply   
 
Thread Tools Display Modes
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-27-2011 , 00:13   Re: TF2 Vote Usermessages
Reply With Quote #21

Success! I have it (sort of) working!

In the attached example, you can vote for you favorite... fruit (although it says map) by having an admin type /vote_start or !vote_start.

I'll likely start writing a Mapchooser variant (maybe a Mapchooser Extended variant) based on this tomorrow, but with better sanity checking for if you should be allowed to vote in the current pool or not.

There's still one catch, though: If another TF2 builtin vote starts while this one is active, I have no idea what happens.

Edit: Still, it couldn't hurt for someone to find out how to make the CVoteController call the vote itself.
Attached Files
File Type: sp Get Plugin or Get Source (vote_test.sp - 432 views - 4.0 KB)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-27-2011 at 00:51. Reason: Updated attachment with version that didn't have two unused public methods
Powerlord is offline
Mecha the Slag
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 05-27-2011 , 08:21   Re: TF2 Vote Usermessages
Reply With Quote #22

Good work! I'll try messing around with this stuff
__________________
Mecha the Slag is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-27-2011 , 10:47   Re: TF2 Vote Usermessages
Reply With Quote #23

Quote:
Originally Posted by Mecha the Slag View Post
Good work! I'll try messing around with this stuff
I was thinking about writing an .inc file, but I was trying to write it similar to the way the Menu API works... but it looks like to create your own Handle, you need to be an extension.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Mecha the Slag
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 05-27-2011 , 11:37   Re: TF2 Vote Usermessages
Reply With Quote #24

I managed to create a group map voter from what you provided above. It's super nifty.

Now we just need to figure out how to change the "Server wants to change map" thingy.
__________________
Mecha the Slag is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-27-2011 , 13:03   Re: TF2 Vote Usermessages
Reply With Quote #25

Quote:
Originally Posted by Mecha the Slag View Post
I managed to create a group map voter from what you provided above. It's super nifty.

Now we just need to figure out how to change the "Server wants to change map" thingy.
I don't know what happens if you pass the vote a string that doesn't start with # as the first String to VoteStart usermessage.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Mecha the Slag
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 05-27-2011 , 13:47   Re: TF2 Vote Usermessages
Reply With Quote #26

Quote:
Originally Posted by Powerlord View Post
I don't know what happens if you pass the vote a string that doesn't start with # as the first String to VoteStart usermessage.
Those with the # refer to a line in the translation files. If you attempt to start a vote using a line that isn't in the translation files, it'll appear blank.

Code:
"TF_vote_changelevel"			"Change current level to %s1?"
"TF_vote_nextlevel"			"Set the next level to %s1?"
"TF_vote_passed_changelevel"		"Changing level to %s1..."
"TF_vote_passed_nextlevel"		"Next level set to %s1..."
"TF_vote_passed_nextlevel_extend"	"Extending the current level"
"TF_vote_nextlevel_choices"		"Vote for the next map!"
__________________

Last edited by Mecha the Slag; 05-27-2011 at 13:51.
Mecha the Slag is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-27-2011 , 14:05   Re: TF2 Vote Usermessages
Reply With Quote #27

Quote:
Originally Posted by Mecha the Slag View Post
Those with the # refer to a line in the translation files. If you attempt to start a vote using a line that isn't in the translation files, it'll appear blank.

Code:
"TF_vote_changelevel"            "Change current level to %s1?"
"TF_vote_nextlevel"            "Set the next level to %s1?"
"TF_vote_passed_changelevel"        "Changing level to %s1..."
"TF_vote_passed_nextlevel"        "Next level set to %s1..."
"TF_vote_passed_nextlevel_extend"    "Extending the current level"
"TF_vote_nextlevel_choices"        "Vote for the next map!"
I know they refer to translation lines. I was wondering if you sent one in the wrong format (i.e. without the #) if it'd use the string itself as the message.

It's a moot point for that particular message, as Valve didn't include it in the translation file.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-30-2011 , 10:22   Re: TF2 Vote Usermessages
Reply With Quote #28

I was learning how to write extensions Saturday and started trying to write an extension to make TFVotes (as I've started calling them) work like the existing Menu/Vote API does yesterday (Sunday).

The idea behind this extension is to present a unified front to the TF2 Voting system, regardless of how the plugin actually implements it. Implementation can change in later versions as long as the interface remains the same.

However, my plans got derailed when, 20 minutes after I started writing this extension (at 5:10pm EDT), my area suffered a massive power outage.

That was 17 hours ago; power is still out at my residence; I'm writing this from a public wifi spot on the other side of town (thank god AlliedMods supports HTTPS). As of 8:00am EDT, the expected time for power restoration is Thursday June 1 (yes, Thursday) at 11:30pm (aka 30 minutes until Friday morning).

I'm downloading the files I need to work on this at work tomorrow if I have some free time (SourceMod source, MetaMod: Source source, MM:S HL2 reverse engineered plugin code for Orange Box...); my laptop has a short enough battery life to be completely unsuitable for this task.

P.S. My office is closed today due to it being a national holiday in the U.S.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-31-2011 at 10:14. Reason: Updated power restoration estimates from Consumers Energy.
Powerlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-02-2011 , 13:31   Re: TF2 Vote Usermessages
Reply With Quote #29

I've been working on this again (power was restored late Tuesday night), but I think I might be better off just implementing a plugin .inc file. Making a vote extension for this will only cover part of the problem, as the vote handler expects the programmer to handle the success and fail parts of the vote.

However, the success and fail parts of the vote is fully half the logic of the plugin I previously posted.

Edit: Or should I just make this its own plugin?
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-02-2011 at 13:36.
Powerlord is offline
Afronanny
Veteran Member
Join Date: Aug 2009
Old 06-02-2011 , 14:37   Re: TF2 Vote Usermessages
Reply With Quote #30

I'd make it as a plugin that provides natives to other plugins.
Afronanny is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode