Unconnected's Forum Posts

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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.

  • Nevermind I found it.

    Max(a,b,c)

    Min(a,b,c)

    "max(a, b [, c...]), min(a, b [, c...]) Calculate maximum or minimum of the given numbers. Any number of parameters can be used as long as there are at least two."

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

    Yes thank you oosyrag

    I was posting this as you posted your message. I was searching for 'lowest' instead of 'min'. I am not sure how I found min, probably just by chance.

  • I have a Repeat loop. I have 2 variables to compare and I would like the repeat loop to repeat the lowest value. Is there a single expression that I can put in the Repeat condition so it can be:

    "Repeat: Lowest Variable1 | Variable2 times".

    I was wanting to avoid an unneeded variable and conditions, but know how to do it this way.

  • Ashely told me another way around it.

    "If you use the scripting feature, BigInt is now widely supported for high precision integers."

    I don't know enough about this feature right now. It will be something I have to look at later.

    construct3.ideas.aha.io/ideas/C3-I-1629

  • You do not have permission to view this post

  • I found a workaround, but I'm only going to say it pseudocode for now. It is a bit excessive, but will be accurate if done correctly. Most people won't need this, but a few will. I may post an example at a later time.

    You take your input and have it as a string instead of an integer. You then use mid() and loops to select each individual character in the string. You then make conditions and actions depending on what you want to do with it. You basically do addition, subtraction, multiplication and long division as you learned it in school. This allows you to do addition, subtraction, multiplication and division by using each individual number instead of taking the whole number into consideration at once. This means you will have to use int() and C3 built in math for the small in-range numbers. You then take the individual answers as you get them and set them to a string.

    Basically instead of using the built in math in C3 you're only using it for the in-range numbers(5-8, 1+2...etc). You must keep the variable a string, otherwise it may round. You are teaching your event sheet how to add, subtract, multiply and divide using the same logic that you used when you learned to do them on paper. Which means you may need to watch a video to remember how to do it on paper. I watched a video to check to see if I handled things correctly.

  • On Start of layout:

    -Loop " " from 0 to 15:

    --Add 9x10^loopindex to variable

    I am getting 10000000000000000 (length is 17) as a result instead of 9999999999999999 (length is 16). I assume it has to do with base but I can't figure out how to get the correct value. I get accurate results if looped less than 16 times though. The expected results should have as many 9s equal to how many times it loops.

    ***edit***

    For my project I don't think many users will be entering more than a 15 digit number. I may just limit how many characters can be entered or I may work around the limit. There will still be a limit if I worked around it but it will be a lot higher than 15 digits.

    Also when I changed the title of the post so it will be more accurate for other people and so others can learn from it too.

    Also a ^ is called a caret symbol.

    ====Edit====

    A solution is in this c3p, at least for multiplication, addition and exponents. I feel most people won't need it though and it will probably be better to use 'Add Script' and BigInt than to manually do it as I did.

    The C3P has a few examples on how to do a few specific things that most people won't need. Be sure to disable all groups except for the one you are looking at.

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