Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Cycling pictures in sequence based on #, Seems pretty easy.
Titanhex
post Sep 17 2011, 04:15 AM
Post #1


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




All my pictures are named Bar-Meter #. # being from 1 to 10.

I've got an event loop that sets and cycles through these pictures. In that loop, a variable increases by 1 up to 10, then goes back down to 1. This repeats til the player hits a button.

I know there's an easier way then creating the Show Picture event ten different times. Something like it gets the number on the end and loops through that based on the variable.

I want to make this a lot easier, so how do I do that?

Hopefully this makes some sense.


__________________________
Go to the top of the page
 
+Quote Post
   
Night5h4d3
post Sep 17 2011, 04:40 AM
Post #2


The past tense
Group Icon

Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed




I /think/ you could do a nested loop, something like:
CODE
while 1 # always
  for i in 1..10 # up to 10
    if Input.trigger?()
      break # break for
    end
    # do stuff
  end
  for i in 10..1 # back down
    if Input.trigger?() or Input.repeat?()
      break
    end
    # do stuff again
  end
  if Input.trigger?() or Input.repeat?()
    break # break while
  end
end


__________________________
Got 30 minutes? Then you've enough time to play this awesome game:

- potentially promising project page
- thanks holder
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   
Titanhex
post Sep 17 2011, 06:13 AM
Post #3


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




How does that make showing the picture easier than calling separate picture files every time >: ?

This is what I got, and I want it to be easier to call the pictures since I know there's a way to grab the picture to load by a string followed by a number.to.string. Since the variable # is the same end number it should work.



Also bonus if someone could tell me how to do it so it can do the picture call at a varying "frame rate" while keeping a 1 frame wait in the loop, so that the button press can be easy and accurate but the rate at which this bar "increases and decreases" can be changed.

This post has been edited by Titanhex: Sep 17 2011, 06:24 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Night5h4d3
post Sep 17 2011, 09:13 AM
Post #4


The past tense
Group Icon

Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed




You'd use a call script to show the picture, and as the file name, you'd pass:
"Bar-Meter #{VAR}" replacing VAR with the variable to use in the name. eg: "Bar-Meter #{$game_variables[1])}"

For the variable wait, you'd call the script version of the wait command passing $game_variables[N] as the variable rate.
eg: @wait_count = $game_variables[N]

Hope that helps.


__________________________
Got 30 minutes? Then you've enough time to play this awesome game:

- potentially promising project page
- thanks holder
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   
Titanhex
post Sep 17 2011, 12:49 PM
Post #5


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




I need to do the wait portion for Input processing. If the total wait within the loop is larger than 1 then the button press check is delayed or won't register at all. So I have to keep the total wait at 1 while still cycling through images at variable rates. That's where it gets especially tricky.

Right now I have a double cog system. Think of two gears. A value called frame cycles through. Once it's gone through 1 cycle it's reset, and the number val is increased one. The full cycle of frame is determined by framerate which is just the difficulty plugged into a formula. Then it does the typical increase, then decrease once at max, increase once at min, repeat, for the val variable.

It should be the cleanest method I think.

I have another deviated question:

Script:
loop
@frame += 1
@frame > 90?@wait_count=1:break
do_stuff
Script:
finish_stuff
end
print "END!"

Done through Script in an event. Error is something about jumping. Obviously the problem is that as scripts they don't connect together. The error made it sound like there was a solution. Is there a way to combine scripts when all you have is the 11 lines per call script and 18 lines?

This post has been edited by Titanhex: Sep 17 2011, 02:19 PM


__________________________
Go to the top of the page
 
+Quote Post
   
Night5h4d3
post Sep 17 2011, 04:43 PM
Post #6


The past tense
Group Icon

Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed




The jumping error is because Script: is a label, and you're creating a label twice. A way to make the script easier to call would be to create a new def in scene_base and call it from $scene.


__________________________
Got 30 minutes? Then you've enough time to play this awesome game:

- potentially promising project page
- thanks holder
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 11:17 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker