Unconnected's Recent Forum Activity

  • I understand it on a basic level. I didn't think of a non-digit in the leading zero. I have to look up [] now, but I need to understand that anyway. It does give the same warning though.

    "WARNING: The expression can return empty matches, and may match infinitely in some cases."

    Will that effect my C3? I don't fully understand what would trigger it or it's full implications in C3. I have a feeling it is a conflict between * after the leading zero group and the global flag and probably doesn't really mean anything. I just want to confirm. I appreciate your help.

    *******edit************

    I tested it on about 10 regex test sites and most didn't give an error. The few that did all looked the same, as if they took the first sites code. I am more confident it is fine now and was just a false flag.

  • I have regexr.com saved I just don't fully understand how to use Regex on that site yet. I can only seem to add a search pattern and Global flag seems to always be on. I mostly didn't know that ( )( ) separated. That was mostly what I needed. Than you again.

    ===edit===

    While typing this I looked at the site again and I just figured it out. There is a dropdown that you have to use to select flags. Also I was expecting a Replace parameter.

    (\D)*(^0+)* /g is working on site and C3. The site is giving me a warning if g flag is on, but it won't work without it. "WARNING: The expression can return empty matches, and may match infinitely in some cases." Is this something I need to worry about, in C3?

  • I am sorry I need one last thing... I want to remove leading Zeros and all non-digits. Is there a way I can do this together or do I need to do this separately.

    I know RegexReplace(String, "^0+", "", "") will remove leading Zeros

    I know RegexReplace(String, "\D", "g", "") will remove all non-Digits

    After posting this I realize the g flag may mess up the ^0+....

  • What I was looking at was accurate, it was just formatted differently so I didn't understand it at the time. It seems some people call (Regex) the Search Pattern or Pattern. For the most part I know how to use it now.

    Thanks

    I can get rid of some unneeded loops now on other events. It will increase my performance for sure.

  • I have it working and was going to upload my tutorial to the original post. It has many kinds of random examples in it. I gave you credit using your username. I can remove it if you want. I want to type more out about Regex() in comments before I post it though. I want to learn about RegexReplace(String, Regex, Flags, Replace)

    Do you have a link that I can learn about Regex? I understand String, Flags and Replace. I am not sure how to search for (Regex). I keep finding tutorials but I don't see anything called Regex other than the expression name. Does it go by different names? What goes there? I just need to be pointed in a direction for now to find out about the Regex that is in parenthesis.

  • Best thing I have heard in a while.

    I already have loops in loops.

    I don't want more loops in loops in loops.

    Thanks.

  • I don't have to know how many leading Zeros there are? It will remove them until there isn't a leading zero?

  • Is there any way I can remove leading zeros in string variables?

    Examples: 010, 00000001, 00000100 should become 10, 1, 100.

    This variable needs to stay a string, I can't convert them to int() or I risk rounding errors on longer numbers. I know how to use mid() to compare the first digit and how to use while to loop. I also know how to use Replace(), but I don't know how to control that Replace() to only the 1st digit. I suspect a few of the app users may copy/paste so monitoring input may cause problems. I mostly just need an expression, action or the basic logic behind it so I can remove the leading zeros all together or one at a time and I can just loop.

    ====edit====

    After some thought I suppose I could compare each digit consecutively using mid() and a loopindex(). If the selected digit ever gets above int(0) then move the rest of the digits to a new string. I feel there may be a better way though.

    ====edit2====

    I understand user input would have to be in something that isn't a variable. I would assume the process would be the same though. Right now I only have this working in debug, I am keeping it modular so I can copy/paste it for later uses.

    ====edit3====

    Solution is in this C3P. This C3P has some examples of a few specific things that not many people will need. Be sure to Disable all groups expect for the one with Regex() in the Group name.

    dropbox.com/s/1v415k8h85jp2wa/Tutorials.c3p

  • I figured I missed it. Thanks for the info

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I opened an old C3 project to read an internal XML file. I was surprised to find the message saying that Construct 2 runtime will be deprecated in July 2021. I understand the need for this. I still have about 5 months to fix what I need, but I was unaware of this until now. I mostly have to remove a few plugins and switch to C3 runtime, it is simple to do. I learned a lot since I first made it so I would need to restructure the project anyways when I am trying to finish it. I put years into the old project and it would have hurt a lot to of lost it. The warning says future versions of C3 may not be able to open the project. I am not sure if I would have lost the project completely or just parts of it would have been removed.

    I am just letting you all know in case you didn't know about it. Something like this probably had an announcement or mentioned somewhere, but I was unaware of it. I did a quick forum search for legacy and didn't see anything in the titles, I probably could have tried harder though.

    Be safe and open old C3 projects in the newest version of C3.

  • I was hoping for an expression, they reduce the amount of conditions and actions if used correctly. Using min() and max() I will get everything I need except for selecting the name of the variable with longest length. I read through a lot of the manual and didn't see an answer to my question. For now I will just use a condition to compare and set a variable to the name of the variable with the longest length. I try to increase performance everywhere I can. An expression would be best though. I try to keep my eventsheets as short as possible. I think an array would use more device resources than a condition and action.

  • So Max(a,b,c), Min(a,b,c) will get me the highest/lowest value. Is there a way I can select the variable though?

    Variable1=5 and Variable2=7

    Min(Variable1,Variable2)

    Will give me 5. Is there an expression so I can get Variable1 back as a result instead of it's value? I know how to get it using conditions and actions though, but want to avoid extra conditions and actions if I can. I am thinking I won't be able to and I will have to use one condition, a variable and an action. I am hoping there is an expression I can wrap around Min() though.

Unconnected's avatar

Unconnected

Member since 6 Apr, 2016

Twitter
Unconnected has 1 followers

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies