RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Juke Box Script V1.0 and 2.0

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
RMU Admin
Here is the demo for my Juke Box script
http://www.box.net/shared/qj5yr5zo50

I only have 1 problem with it, it takes 10sec to open the juke box. Try it out and fix it if you want credit for it.

Let me know what you think

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Umm, well, it's not loading fast because you are drawing your window contents 36 times each  :-\


see in your refresh method, you have:

for i in 0...@item_max
  draw_item(i)
end

and it is proceeding to that method, but that method draws everything in the window. There are a few things I'd change about this. First:

From 22 onward, it is checking if it has the 22nd item in the inventory rather than their respective numbers (23,24,25,etc...)

Secondly, I would probably change the draw_item method so that it draws only one item at a time, and keep the for loop in refresh.

Third, I wouldn't use items I don't think, I think I would set up a boolean array, and then when you get a song, just change the appropriate index to true. That way, they won't clog up the inventory.

Oh, and also, you should use class variables in your scene, not globals. Instead of $help_window, @help_window.

Otherwise, it is a good script and it certainly functions properly, and that is the most important part of the script. If I were you though, I would definitely make it so that it doesn't draw the contents 36 times. All the other things are just suggestions, except maybe the global variables thing.

EDIT:

Oh, and it might be a good idea to get rid of the print message. It doesn't really fit in with an RPG setting to have a Windows Box appear. Maybe instead just draw those ones with a disabled color and play a buzzer if you try to select it.

« Last Edit: July 20, 2007, 01:47:07 AM by modern algebra »

***
Rep:
Level 87
RMU Admin
Im not good at scripting yet, So how would i make it so it will draws only one item?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, in the context of using items, you could do it like this:
in refresh:
Code: [Select]
  def refresh
    self.contents.clear
    for i in 1...@item_max
      draw_item(i)
    end
  end

and then the draw_item method:
Code: [Select]
  def draw_item(index)
    if $game_party.item_number(index) > 0
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    self.contents.draw_text(4 + 216*(index%3), 32*(index/3), 128, 30, $data_items[index].name)
  end 


***
Rep:
Level 87
RMU Admin
Thank you so much you will be put in the credits

***
Rep:
Level 87
RMU Admin
Sory about the double post

how would i make it where it would only show certian items like only show item 3,5,8,etc...
Cause i have lots more to add than whats on there right now

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
well, first you should decrease the size of the window from 480 height to 414, and then all you have to do is increase @item_max in order to draw more. If you want to specify which items it should draw, then just do some modifications to the:

for i in 0...@item_max
  draw_item (i)
end

For instance, one way you can do it is to store all the music you want to display in an array like this:

Code: [Select]
@music = ["001-Battle01", "002-Battle02", etc...]
@item_max = @music.size
for i in 0...@item_size
  draw_item(i)
end

And then in draw_item, change this line:

Code: [Select]
self.contents.draw_text(4 + 216*(index%3), 32*(index/3), 128, 30, $data_items[index].name)

to this:

Code: [Select]
self.contents.draw_text(4 + 216*(index%3), 32*(index/3), 128, 30, @music[index])

This would also make the other part of the script much simpler because instead of the case statement you have, you could replace that entire thing with:

Code: [Select]
Audio.bgm_play("Audio/BGM/" + @music[@command_window.index],100, 100)

You would, of course have to find another way to check for whether the party has that song yet.
If you still want to have the songs as items, then maybe instead of that first line where I said:

Code: [Select]
@music = ["001-Battle01", "002-Battle02", etc...]

you could change it to

Code: [Select]
@music = [["001-Battle01", <item_number of that song>], ["002-Battle02",<item_number of that song>], etc...]

and then that line in your update method:

Code: [Select]
Audio.bgm_play("Audio/BGM/" + @music[@command_window.index],100, 100)

you could change to:

Code: [Select]
if $game_party.item_number (@music[@command_window.index][1]) > 0
  Audio.bgm_play("Audio/BGM/" + @music[@command_window.index][0],100, 100)
end

In any case, if I were making a jukebox, I don't think I would do it with existing items, but that's just me. Try that stuff and if you don't understand, I'll make a demo.

***
Rep:
Level 87
RMU Admin
i will try it and if i don't understand it i will let you know

**
Rep: +0/-0Level 83
Solved.  You must change @music to $music in every case it appears. 

Now the only problem that remains is finding out how RGSS can determine whether an audio file is a midi or an mp3. 
« Last Edit: August 03, 2010, 07:08:01 PM by GreenBanana »