Old 07-31-2010, 10:31 PM   #1
Daisuke Master
Member
 
Daisuke Master's Avatar
 
Join Date: Oct 2006
Location: Mexico
Posts: 1,073
Daisuke Master is a 1 bar user
Reputation: 10

Post rating: Votes: 1 Score: 1rate    
Lightbulb [SM5/SSC] Custom Code Detector

I had to format the readme part and put the code in a pastie because it reached the 10000 chars limit

Custom Code Detector by Daisuke Master

Whats this?
Just that, a custom codedetector, you can add the codenames as exact mods and this thingy will do whatever you wanted to do with the oh-so-known harcoded codedetector. I kind of don't like the codedetector for various reasons, that's why I made this (also the remaining stuff happened by accident lol), anyway, if you feel like wanting this in your theme, go ahead! no problem, just let me know that you're using it and that this was useful for you ^^

How to use
First of all, put this lua module under the Scripts folder of your theme.
Using codeset, put this in a CodeMessageCommand, inside a function command, under ScreenSelectMusic, like this:

Code:
CodeMessageCommand=function(self)
	CustomCodeDetector()
end;
You'll need codename and player to be passed as arguments, you can get those somewhere:

Code:
CodeMessageCommand=function(self,params)
	CustomCodeDetector(params.Name, params.PlayerNumber)
end;
If you like to be classy like me:

Code:
CodeMessageCommand=function(self,params)
	local code = params.Name
	local player = params.PlayerNumber
	if not GAMESTATE:IsHumanPlayer(player) then return end;
	
	CustomCodeDetector(code, player)
end;
Niceties:

Code:
CodeMessageCommand=function(self,params)
	local code = params.Name
	local player = params.PlayerNumber
	if not GAMESTATE:IsHumanPlayer(player) then return end;
	
	if CustomCodeDetector(code, player, true) then
		--idk what to put here so eh...
	else
		--handle here other codes for misc purposes
	end
	
	SOUND:PlayOnce(THEME:GetPathS("ScreenSelectMusic","Options"))
end;
Extras: you can set a third param as true to deactivate sound and the message broadcast to handle those outside (example above)

What more? Oh yes, you'll need a CodeNames line under ScreenSelectMusic

Code:
[ScreenSelectMusic]
CodeNames="Noteskin,Speed,Cancel,Dark,Mirror"
;main codes
CodeNoteskin="Up,Up,Down,Down,Left,Right,Left,Right"
CodeSpeed="Left,Right,Left,Right,Down"
CodeCancel="Select,Select"
;secondary codes
CodeDark="Down,Down,Left,Right,Down"
CodeMirror="Down,Left,Up,Down,Right,Up"
The first three (speed, noteskin and cancle er... cancel) are mandatory, the
rest are optional (dark and mirror as examples)

Caveats
  • I don't know what will happen if illegal modifiers are set into the CodeNames line under ScreenSelectMusic, so try at your own risk (not that anything bad but a crash may happen, I don't know so I'm just warning you).
  • I don't know what will happen if you add percentages and/or approach into the modifiers (for example >Code50% tornado="@Right-Up")
  • Ignore the previous two points, I just added a mod validator function, if your mod does not exists there just add it.
  • You just can't set multiple modifiers in one code because of how codes are separated (by commas)
  • FOR PUMP-SM USERS: Watch out when using center as part of your code, it's treated as start button and you know what happens when you press start, solution: you can use two part selection in metrics along with twopart confirms only so you can doublepress center with no problems, remember that only sm-ssc can do that (goes the same to ez2/popn users with footdown/red buttons).
  • Don't try weird things with this.

TODO list
  • Previous speed and noteskins
  • Go lazy and lowercase GetPlayerOptions

Licensing
IMO it's important, I don't like to see my work being hijacked by someone else and claiming as it's own (others don't like that either) so here we go:

I'm licensing this under Creative Commons by-sa 3.0

This means that:

You can share and adapt this code as you like/need/want withouth worry, but you must attribute me, and if you release your modified work you must license it with the same license as this.

Credits
  • DaisuMaster

Thanks
  • main stepmania devteam (they created SM)
  • sm-ssc devteam (they forked sm4 and tweaked it in an astounding way)
  • cesarmades (this guy inspired me somehow)

Final notes
That's all you should need to know for now, and as I said, feel free to use this and let me know if this was useful for you ^^

And the code itself (along with the previous notes but in an ASCII format)

02 CustomCodeDetector.lua

Hope you like it :)
__________________

Last edited by Daisuke Master; 08-04-2010 at 09:12 PM..
Daisuke Master is offline   Reply With Quote
Old 08-02-2010, 07:39 PM   #2
FSX
Member
 
Join Date: Nov 2006
Posts: 2,805
FSX is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

It took me a second to realize what this was, but now I get it. Pretty cool.
__________________
BAAAAAAAAAAAAAAAAAAAAAAWWWWWWWW
FSX is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Region Code NeoSpearBlade General Video Games 1 05-22-2010 01:13 AM
Help with code goofwear General questions 3 02-14-2010 06:50 AM
help with this code please... Daisuke Master Theme/Noteskin Help/Questions/Requests 2 12-08-2008 06:29 PM
source code orsela General StepMania 4 08-14-2008 11:14 AM
hello. This is code. Sniper257 General questions 13 12-06-2007 06:30 AM


All times are GMT. The time now is 11:21 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Thanks to

SourceForge.net Logo