LOOP HELP

Posts

Pages: first 12 next last
Sorry if someone has already requested this somewhere else but I'm really stuck.
I'm trying to design a weapon that requires the button being pressed and held. It's basically like a flame thrower. But ever since they started manufacturing dual processors, I've had problems getting loops to work. Even if I use labels. When the button is pressed it seems to work for a short random amount of time. Then the key pressed seems to break. It's like it just forgets the key is being pressed even though I haven't physically taken my finger off of it. This is a real problem because I'm at the very last chapter of a 3 year project and still can't get this to work properly. Does any one know if they can help or maybe why it's doing this. NOTE: This seems to happen to all rpg maker games I've made on several different computers with multiple processors. Been trying to solve this problem for about 6 years now and no one seems to have an answer.
Hi Ashes,

I can't specifically help you troubleshoot any problems with the way dual processing handles RPG Maker, but maybe I can offer something about loops.

What are the conditions that cause the loop to break?

(By this, I mean, the conditions that you've set, not the environmental conditions where the loop breaks unexpectedly)
What I do against this problem is that I add several steps of checking if the button has been released before actually releasing it. Think of it something along the line of this


label 1
input = input key
if(input == 5)
-- do stuff --
jump to label 1
end if

wait 0.0
input = input key
if(input == 5)
-- do stuff --
jump to label 1
end if

wait 0.0
input = input key
if(input == 5)
-- do stuff--
jump to label 1
end if

-- button has been released --


This doesn't solve the problem entirely, but the more steps you add in, the less likely it is to occur, and it will hardly be noticable until you add like... 9 or 10 steps with 0.0 waits (at which point the problem will be pretty non existant... and you'd consider creating a secondary loop for the steps)
I'll give it a try and see if that will work I really appreciate the quick responses!

author=Zachary_Braun
Hi Ashes,

I can't specifically help you troubleshoot any problems with the way dual processing handles RPG Maker, but maybe I can offer something about loops.

What are the conditions that cause the loop to break?

(By this, I mean, the conditions that you've set, not the environmental conditions where the loop breaks unexpectedly)


The only break loop I have at the moment is just to see if the key is still being pressed. That's it.
Do you mean, you have something similar to this setup:


Loop
Key Input Processing (Store in Var [0010:Key Pressed], Don't Wait)
If Var [0010:Key Pressed] == 5 (The action key)
Turn Switch [0001:KeyIsBeingPressed] ON
Else
Turn Switch [0001:KeyIsBeingPressed] OFF
If Switch [0001:KeyIsBeingPressed] == OFF
Break Loop
End Loop
It does

Key press wait to key press
0.0
If key is equal to 6
Switch on
Loop
Key press no wait
0.0
If key press is 6
Do nothing

Else
Switch off break loop


Like Kazesui suggests, we're going to have to defeat RPG maker's standard internal loop processing, which the dual processors are messing up somehow. It's as if the dual processors are making the loop execute too quickly.

This game sounds action-oriented. If this loop is contained inside of a parallel process, consider breaking it up into multiple parallel processes. For example,

Inside parallel process event 1:

Key Input Processing, Wait
If key entered = 6
Switch "FLAMETHROWER" ON


On the second page of that event, activated when "FLAMETHROWER" is on:

Key Input Processing, No Wait
If key entered != 6
Switch "FLAMETHROWER" OFF


Meanwhile, in a separate parallel processing event, the code for the flamethrower is there when "FLAMETHROWER" is turned on.

This does the exact same thing as your code, but using a different method. We simply have to find a method that the dual processors can't misinterpret.
Okay. I'll give them both a shot and let you know what happens
All right, so the split events didn't work. But... But, the bombardment of code actually seems to have worked!!!! I think it will work and as long as I tweak around with it, it will work just fine! Thanks again everyone. I really appreciate all of your help.
I can think of two possible solutions to this.

Oh wait, someone did suggest by first idea. Onto the second!

If you used DynRPG and the Keyboard plugin, whenever you press a button a switch is turned on for as long as it's pressed, which would be the trigger for the flames. It's possible that the same issue would occur but less likely based on my experience with this plugin. It would also allow you to use the entire keyboard, so that's an extra bonus. I don't think DynRPG would really affect anything negatively in your project, but I know some people are afraid to do it. It might be worth testing, as you wouldn't have much trouble with this issue anymore. Maybe.

I ran into this problem when I tried to introduce a strafe command in my Zelda game, it would randomly break off the strafing. My solution was, for now, no strafing :(
Alright. I'll look into it. See if it can fix the problem. The 1st solution where the code is repeated gave me and idea. I toyed around with it and got something that so far has worked better than anything ever before but still breaks from time to time. Where can I find this Dyn RPG as well as the production notes on it.
How many steps are you using? I've personally mostly been using a 4-5 step solution for this problem.
You could try to use this specific code and mess a bit with the second branch which gives the amount of steps to include. The more steps, the statistically less likely it is for the cycle to break (unless the idea you spoke already looks something like this)

Alright and that fixes it completely? I'll give it a shot.
Rather than fix it completely, it should make it very unlikely for it to accidently break the cycle. With a 10 step cycle like this, it will have to randomly think you're not holding down the key 10 times in a row, and I haven't heard many complaints over my 5 step solution in Zero Base and Curse of Cpt. Loveless, so it should for all practical purposes be fixed with the 10 step solution (less should be okay too).
Comes at the expense of the key first being fully released 0.167 seconds after having released it though (the 10 step solution that is)
author=Ashes of Emerald
Alright. I'll look into it. See if it can fix the problem. The 1st solution where the code is repeated gave me and idea. I toyed around with it and got something that so far has worked better than anything ever before but still breaks from time to time. Where can I find this Dyn RPG as well as the production notes on it.

Look at my most recent tutorial for The Flow of Time. The first part explains how to get DynRPG installed, with links to DynRPG and the plugins. Be sure to back up your entire project folder, I heard Feld say that DynRPG made his game unplayable. I added DynRPG to my Zelda game though, and it works just fine, so don't let that deter you from trying this. DynRPG is awesome. If this all works, I would suggest testing the rest of the game to make sure nothing else is affected by DynRPG. It sounds like a lot of extra effort, but it's worth it in the end.

Once you extract the plugin you will see a readme file and a test project that will show you how to add the necessary lines to DynRPG.ini. You tell the .ini file which switch is associated with any key on the keyboard, then go into the editor and name the switch to match the button. Like, switch 1 would be called "Pressing Spacebar". And when spacebar is pressed, switch 1 will remain ON.

These key presses seem to supersede any other event processing. Like when your stuck in an autostart process where normally you can't move, you can still activate these switches. Which is why I think it will work for you.

Let me know if you need any further help setting this up.
Okay I downloaded it but I can't figure out how to get RPG maker to recognize the keyboard. I also find that it breaks all of the semi-transparency in rpgmaker and makes it lag terribly... What can I do? Also before, I used comments to separate all of my code since they weren't being processed.
OMG, Got the commands to work, but still suffering from terrible lag and the transparency problem so far.
Hmm, then perhaps your game isn't going to work well with DynRPG. I don't know what would be causing lag. I do remember there were some issues with transparency mentioned by Cherry. Not sure if he's still updating it, I would think he is though.
I'm still going to you around with it. It's just frustrating to finally have an answer only for it to do more harm than good.
Try disabling some parallel processes maybe
Pages: first 12 next last