Go Back   StepMania Forums > StepMania Discussion > Themes, NoteSkins, Game Types > Theme/Noteskin Help/Questions/Requests

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-22-2009, 10:25 AM   #1
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Rate this thread:
  • Currently 0.00/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
[0]
Default Lua bindings in 3.95/OpenITG

Ok guys, here's the problem: I don't get how I'm supposed to use the lua bindings.

For example I needed to work with the active percentage during the song, I found on the StepMania theming wiki that GetPercentDancePoints was added in PlayerStageStats, then I luckily found the STATSMAN:GetCurStageStats():GetPlayerStageStats(pn ):GetCaloriesBurned() line in other.lua and modified it for my needs, but I still don't understand how to build that "address". Can somebody please explain it to me?
dj jack is offline   Reply With Quote
Old 10-23-2009, 07:32 AM   #2
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Please guys, I really need this in a short time!
dj jack is offline   Reply With Quote
Old 10-23-2009, 11:56 AM   #3
FSX
Member
 
Join Date: Nov 2006
Posts: 2,047
FSX is a 4 bar user
Reputation: 33

Post rating: Votes: 0 Score: 0rate    
Default

You can use singletons anywhere you would use a value.
__________________
BAAAAAAAAAAAAAAAAAAAAAAWWWWWWWW
FSX is online now   Reply With Quote
Old 10-23-2009, 02:09 PM   #4
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

I know that, what I need to know is how the STATSMAN:GetCurStageStats():GetPlayerStageStats(pn ):GetCaloriesBurned() line was determined. What I mean is: GetCaloriesBurned() is listed on this page http://www.stepmania.com/wiki/Lua_sc...Actor_commands under the PlayerStageStats class. How can I understand in wich singleton is every class comprised?

Let's say I need to get the highest machine score for the currently playing song. I see a GetPercentDP( ) function in the HighScore class, but how can I actually refer to it in the lua scripts?
dj jack is offline   Reply With Quote
Old 10-30-2009, 12:56 AM   #5
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Come on, I can't believe none of the awesome themers knows the answer.. Please =(
dj jack is offline   Reply With Quote
Old 10-30-2009, 04:32 AM   #6
Midiman
Angry Old Lady
 
Midiman's Avatar
 
Join Date: Aug 2007
Posts: 1,182
Midiman is a 7 bar userMidiman is a 7 bar user
Reputation: 107

Send a message via AIM to Midiman
Post rating: Votes: 0 Score: 0rate    
Default

Getting PlayerStageStats:
@STATSMAN:GetCurStageStats():GetPlayerStageStats(P LAYER_1):GetCaloriesBurned();
should return something. like:
<BitmapText File="Blah" NoteCrossed250Command="@function(self) self:settext(STATSMAN:GetCurStageStats():GetPlayer StageStats(PLAYER_1):GetCaloriesBurned()); end;"
/>

that is, if I recall correctly. I could be wrong and might have to try it out but I dont have anything to do with at this time
__________________
cool, I have a forum ( GO JOIN ALREADY )
http://midiman.darkskystudios.net/forum/
also join #midiman on irc.badnik.net.
Midiman is offline   Reply With Quote
Old 10-30-2009, 07:44 AM   #7
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

That still doesn't help me in understanding how to call the GetPercentDP( ) function in the HighScore class or any other function. =/ What I don't get is how to reach, for example, the HighScore class starting from a singleton.
dj jack is offline   Reply With Quote
Old 11-03-2009, 05:29 PM   #8
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

Ok I'll try to be more clear: I need to access the highest score for the current song while inside of ScreenGameplay. I've been reading the source code for hours and still haven't got a clue on how to build the function call. Can somebody please help me?
dj jack is offline   Reply With Quote
Old 11-03-2009, 05:52 PM   #9
AJ 187
REAL STEPPING ROOTS '09
 
AJ 187's Avatar
 
Join Date: Aug 2006
Location: Chicago
Posts: 1,432
AJ 187 is a 7 bar userAJ 187 is a 7 bar user
Reputation: 115

Send a message via AIM to AJ 187
Post rating: Votes: 0 Score: 0rate    
Default

the high score list requires a profile, so this is a multi-step process.

First, you need to get the correct profile. I use this function to do that:
Code:
function Profile(pn)
	if PROFILEMAN:IsPersistentProfile(pn) then
		-- player profile
		return PROFILEMAN:GetProfile(pn);
	else
		-- machine profile
		return PROFILEMAN:GetMachineProfile();
	end;
end;
This is done to make sure we have a profile to fall back on, in case the player isn't using one.

From there...

Code:
<BitmapText
	File="Blah"
	OnCommand="@playcommand,Set"
	SetCommand="@function(self)
		local SongOrCourse, StepsOrTrail;

		local scorelist;
		local text = "";
		local profile;

		if GAMESTATE:IsCourseMode() then
			SongOrCourse = GAMESTATE:GetCurrentCourse();
			StepsOrTrail = GAMESTATE:GetCurrentTrail(pn);
		else
			SongOrCourse = GAMESTATE:GetCurrentSong();
			StepsOrTrail = GAMESTATE:GetCurrentSteps(pn);
		end;
		if SongOrCourse then
			if StepsOrTrail then
				profile = Profile(pn);
				scorelist = profile:GetHighScoreList(SongOrCourse,StepsOrTrail);
				assert(scorelist);
				local scores = scorelist:GetHighScores();
				local topscore = scores[1];
				if not topscore then
					text = string.format("%.2f%%", 0);
				else
					text = string.format("%.2f%%", topscore:GetPercentDP()*100.0);
				end;
			else
				text = "";
			end;
		else
			text = "";
		end;
		self:settext(text);
	end;"
/>
Even though it's not for OpenITG, I'm going to link the SM4CVS Lua reference, as a lot of the commands/structures exist in OpenITG.

Hope this helps.
__________________
Event mode exists for a reason. Use it.

We're doing it for fun, we're doing it because we can, we're doing it because we're SSC.
Follow @kki_ssc on Twitter for KKI Labs/spinal shark collective news as it breaks!
AJ 187 is offline   Reply With Quote
Old 11-03-2009, 06:13 PM   #10
dj jack
Member
 
Join Date: Feb 2007
Posts: 12
dj jack is a 1 bar user
Reputation: 10

Post rating: Votes: 0 Score: 0rate    
Default

I love you.

Also I've been using this but it looks outdated and incomplete. Thank you very much for your advice =) It is EXACTLY what I needed!

EDIT: Sadly it doesn't really work. I think there is something wrong as the GetHighScoreList function is nowhere to be seen in OpenITG's source code =(

Last edited by dj jack; 11-04-2009 at 01:47 PM..
dj jack 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
Changing the key bindings screen DarkX9 Theme/Noteskin Help/Questions/Requests 1 06-06-2009 10:10 PM
OpenITg help!? blacksausage666 Other music games 1 04-06-2009 06:27 AM
OpenITG alpha 8 sicklyboy 3rd-Party builds 0 01-16-2009 08:05 PM
OpenITG Help dancingcactus27 3rd-Party builds 5 12-16-2008 02:16 AM
3.95 and openITG NeoSpearBlade 3rd-Party builds 29 05-28-2008 06:10 AM


All times are GMT. The time now is 01:14 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Translate

Thanks to

SourceForge.net Logo

Random Pictures