Chris TCC
Chris TCC
CC#
Created by Chris TCC on 5/3/2023 in #help
❔ store data like a filesystem
I'm working on an app, where the data structure is as follows: Group -> subgroup -> values The user can create groups, name them, and add subgroups inside them. The subgroups can have names too, and contain a list of int values. The app will then do some comparisons and list the smallest int value given some conditions etc. (That part isn't too important) How I currently do this is by using a triple layered list, but it is quite messy and is difficult for me to trace myself relative to the hierarchy, such as knowing when a subgroup is added etc. I use events and subscriptions to broadcast adding and removing groups/subgroups/values to the parents and grandparents, and when processing the data I use a for loop to loop through each branch of this hierarchy, comparing them with an if statement to get the value needed. Is there any more efficient way to do this? Sorry if the explanation is bad, I'm not good at doing this. I'm also fully self taught so pls be gentle with me 😅
74 replies
CC#
Created by Chris TCC on 3/16/2023 in #help
❔ how to make an API call
I have tried looking up tutorials but they ended up making me more confused. I want to take a string, generate an API call from that, then download the response. The API takes a URL-encoded string, and returns a link to a wav file, which I'd like to download. Is that possible? here's the link to the API I'd like to try using: https://tts.cyzon.us/ https://github.com/calzoneman/aeiou/blob/master/docs/usage-guidelines.md
206 replies
CC#
Created by Chris TCC on 3/8/2023 in #help
❔ regex spamfilter
I'm trying to make a spam filter using regex. It's quite the undertaking, is anyone able to give me some pointers? Currently, I'm working on a repeat word filter. These are the conditions: - word repeated more than 3 times - group of words repeated more than 3 times - return false when the repeats have other irrelevant words imbetween some examples:
something test test test test test test do it now - true (test)
something testing idk testing idk testing idk lol you idiot - true (testing idk)
hello my name is chris and idk why my name is chris but all i can say is that my name is chris - false (there are repeats but other irrelevant words in between
something test test test test test test do it now - true (test)
something testing idk testing idk testing idk lol you idiot - true (testing idk)
hello my name is chris and idk why my name is chris but all i can say is that my name is chris - false (there are repeats but other irrelevant words in between
currently I've got this (\b\w+\b)\s+\b\1\b\s\b\1\b but it considers the 2nd case as false - it can't detect multiple word groups.
16 replies
CC#
Created by Chris TCC on 2/25/2023 in #help
❔ trim string according to regex
I've got this regex string, ^(?:\b\w+\b[\s\r\n]*){1,25}$ which is supposed to verify the string doesn't have more than 25 words. How do I use this regex (or modifications of it) to trim the string to 25 words if it's longer than that? (when the regex check fails)
89 replies
CC#
Created by Chris TCC on 1/16/2023 in #help
✅ learning tree data structure
I've got some data that I'd like to store for a unity app. The data is perfect for a 3-level tree, but I have never used that data structure before. Currently I'm using a triple layered list, and my code is a MESS. Does anyone know any good tutorials for me to research? Currently I've tried but can only find tutorials on actual trees, and tutorials explaining how the data structure works, but not how to write the code.
57 replies
CC#
Created by Chris TCC on 1/4/2023 in #help
✅ help with regex
I'm trying to learn regex, have watched multiple tutorials and checked multiple websites, but can't fully grasp how to use it for my specific situation. I want to find and retrieve a certain part out of a string: the word that follows an @. currently I have this: ^@[a-zA-Z0-9]+$ Here are some example cases: word @something -> true @something -> true word@something -> false I'd like to be able to retrieve the @something from those examples, whilst ignoring the rest. Would my regex work? I've tried it with this website (https://regexr.com) but it doesn't seem to work...
44 replies
CC#
Created by Chris TCC on 1/3/2023 in #help
retrieving dictionary value
I've got a dictionary that stores a string key and a bool as it's value. How do I retrieve the bool value for use in an if-statement? Currently I'm doing this:
bool tempLurkStatus;
if(lurkStatus.TryGetValue(userName, out tempLurkStatus) && tempLurkStatus == true)
bool tempLurkStatus;
if(lurkStatus.TryGetValue(userName, out tempLurkStatus) && tempLurkStatus == true)
19 replies
CC#
Created by Chris TCC on 1/3/2023 in #help
list that holds 2 values each
I want to have a way to store a dynamic amount of data, where each entry holds a string and an int. What is the best way to handle this? I'm thinking along the lines of a 2d list, or if that's not possible, maybe just 2 lists where I use code to compare the values imbetween them (values stored at the same index)
64 replies
CC#
Created by Chris TCC on 1/2/2023 in #help
shared variables between actions
Is there any way to do this? I've got a system that plays videos, but from mulitple actions - I wanna be able to make a queue system so they play one after another.
21 replies
CC#
Created by Chris TCC on 12/30/2022 in #help
❔ ✅ filtering, dissecting a string for processing
Not sure how to search for this online, so I'm asking here. I have a user input system, and I want to figure out how to dissect the string in code. Basically, there are different types of inputs the user can give. Examples would be: <Text> @text #textand3numbers General messages with symbols I'd like to be able to differentiate these types of inputs, and do different actions. I was thinking maybe using Contains(); but it can't differentiate a @text from a regular string that includes the @ symbol. Is that even possible to do this without overcomplicating things?
30 replies