Infinite loop?

ShinyPickle

New Member
Reaction score
9
I think there is an infinite loop in my trigger, but I don't know where. It's actually a series of triggers that were working fine last night, and I don't think I changed them. Here are the triggers.

Trigger1
Event: Player - Player 1 (Red) types a chat message containing <Empty String> as An exact match

Action: Set Integer = (Integer((Entered chat string)))
That sets the integer to whatever number the player types. That was working.


Trigger2
Event: Time - Every 0.50 seconds of game time

Condition: Integer Greater than (Level of (Random unit from (Units in Region <gen>)))

Action: Trigger - Run Trigger3 <gen> (checking conditions)

If the number you typed in trigger1 is higher then the level of the unit currently in the region, it runs this trigger.

Action: If (Integer Equal to 1) then do (Unit - Remove (Random unit from (Units in Region <gen>)) from the game) else do (Do nothing)

Action: If (Integer Equal to 1) then do (Unit - Create 1 Unitl level 1 for Player 1 (Red) at (Center of Region <gen>) facing (Position of Barracks 0000 <gen>)) else do (Do nothing)

It was working fine last night... I wanted it to be so that when a specific event happens (Like the player typing the number, which was just to test it) it would change the value of the integer accordingly, thus placing the correct unit in the region. I had the same action in trigger3 5 times. One for each level. But when I test it, it creates infinite units one after another until I quit the game.
 

Exide

I am amazingly focused right now!
Reaction score
448
Um..
What the heck are these triggers? :p

-Why are you suspecting an infinite loop in one (or all) of these triggers?
-What happens?
-What is supposed to happen?
 

ShinyPickle

New Member
Reaction score
9
Um..
What the heck are these triggers? :p

-Why are you suspecting an infinite loop in one (or all) of these triggers?
-What happens?
-What is supposed to happen?

When I test the map, it keeps creating units in the same region one after another when I only want it to create one.
 

the Lumpy

►►►
Reaction score
53
Well, as long as the condition in Trigger 2 is true, Trigger 3 will run every .5 seconds. Keep in mind that the condition will only work as expected as long as there's only one unit in the region at a time.

As a last resort, you could set Integer to 0 after you create the unit -- that should stop the trigger from being run repeatedly.
 

ShinyPickle

New Member
Reaction score
9
But it only does it as long as the Intger is higher then the level of the unit... Maybe I screwed up and deleted an action from the trigger by mistake... I'll check that out.
 

cowmenace

New Member
Reaction score
22
Try this

In your second trigger, create a dummy for the player you want. set the dummy's custom value to 50. Make a .1 second expiration timer on the dummy.
In your third trigger, have the event be (Unit - A unit dies) and the condition be (Integer Comparison - Custom value of (Dying Unit) equal to 50)

that will also allow for the trigger to be MUI.

NOTE: your trigger leaks and since it is every .5 seconds you should make it leakless. http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=27219
read that it will make your game much less laggy


If that doesn't work, then try turning off the third trigger as the last action in it.
 

the Lumpy

►►►
Reaction score
53
The best way you can help us help you is by explaining what you intend to use this for in as much detail as possible.

I recall you said that you were just using the chat message event for testing. It looks like you want the unit to be updated automatically whenever the variable changes. If this is the case, you might consider making your variable a real instead of an integer -- you would have to do a lot of conversions between real and integer types, but it would allow you to use the Game - Value Of Real Variable event.
 

cowmenace

New Member
Reaction score
22
Shinypickle -
I got the trigger finished, but the viruses are unable to have the ability locust, so I included another trigger that prevents a player from moving the unit at all. I also took the liberty in removing leaks and a bug that I found (typing in a number like 123 would spawn a million question marks) Be sure to read my trigger comments for tweaking things the way you want. You have private messages disabled so I put my message here =). Anyway give me an email at [email protected] and I'll send it over to you, or give me permission to post it in this thread and I will.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top