#⌨coders-cave
1 messages · Page 46 of 1
U have easy situation as I'm 15 but I get money from summer jobs and my parents have decent wagr and all
strict rules about age
same here except i dont get my own money
im asking like
$8
in the terms of 1 year
just for earphone
that's broken in a few days
Well, if your parents are having a hard time, you probably should do a part time job because they wont buy you anything
ik
but no shit
they just
"you need to study"
no can't work
my brother is in university but doesn't have a part time job
stop using your phone for a week
phone exists
i might be able to do that
since i had some
break
If they asj you why
i can finally let go of my phone
It will
reverse psychology??
Coding on mobile
by roughly 30%
Not the best thing
phone screens hurt my eyes so fuckin much
Yea phone screens are much harsher on the eyes
for u yes not for me
Rhe text so small u have to focus so much
not me
Youre probably used to it that you wont feel it
im young
yes
Jupe said he is 15
only reason my dad gave me permiu to buy this good pc with 400€ is because I said it'll make coding easier lol
I'm 15 lol
and im 14 and puberty hits me like a truck
no
If they said they can't afford it
DUDR
Twll them you'll work
my mom wage can only make us through 3 weeks and a few days
U have yourself a pc
U said minimum wage
I bought my first setup with 12€
yoy don't need that much
tou could easily get pc with that
Raspberry pi
my mom makes $360/mo
older yeah
Its like 40$ for the best version
how much is euro to usd
With alot of ram
are you in the USA
no
Uhh one euro is like 1.3 USD or something
i live in indonesia
but i can translate usd to my native currency easier
oh ok
holy cow
there's no way
the only pc that cost like
less than 100 dollars
Wtf 1 indonesia is 0,00 euro

Oh lmao
Better than 4000
my school sold old pc hardware like from 2007 and I got PC without hard drive for 2€ because I know the it guy in my school. Then I got hard drive with 10€ and got monitor for free, keyboard for free and mouse for free
xD
my school pc is non-existent
they told us
about hardware
without actually seeing it
and about microsoft paint
there are some scrap computers somewhere most likely
and even made mistakes about
ctrl+a to undo
and mock me for being wrong
and the teacher said
its ctrl+z
AND SO I LAUGHED AT THEM
hahahhaa
indeed
they cost <$100
Scrap PC's are amazing tho
not really
some have broken screen
a faulty hardware
or a virus installed
ehem
Hello your computer has virus
Viruses can easily be deleted and that other stuff is why I love scrap PC's
my current pc is made out of server parts from 2012-2018
Lol
or was it ddr2
Probably ddr2
I have 16 gigs of ddr2 laying around
nice
Here working around 10 hours a day makes you 35$ a month
On average
Not the best economy
minimum wage here is 6€/hour
Here its 3$ a month
you can't die if you never live

so barely living
I can buy instant noodles
and feed myself for a few days with $3/mo
instant noodles are less than 50 cent
instant noodles are like 1€ a pack here
bread are more expensive
welp rip economy
welp
It's just sad for me to thibk people have to live like that when I own like 800€ worth of stuff I wouldn't actually need
nice
I mean thankfully i dont live like that
We are considered rich
I guess
Even though my dad makes like 700$ a month
Same, for 15 year peoples atleast
You'll never get minimum wage tho, always higher like x1.5 or something
Here you will barely get minimum wage if ur lucky
Huh?
Its oretty fucked up
Do you mean you get lower?
Woah that's really fucked up
Yes it is
Most good teachers rather tutor or go to private schools because government schools pay like 10$ a month
Took about 2 hours to do with my mom folding the papers
The paper eventually stopped lol so now I'm jobless
My dad's friends, the best math teacher ive known, never taught in a school
Always tutoring
Interesting
His friend
Never tqught in a public school
Tutorinf or private school
And they are living a good life
Teachers that are not as good cant tutor and they wont be accpted in private schools
So they live on 10$ a month
And work another job to cover the rest
When i was in highschool
The principal of the school
Worked as a barber after school
ahahah awesome
Lmao
Damn
im not a coder
Then leave
Begone none coder or we shall burn you like a witch
"Non-coders shan't deceive us, we shall greet their cheeks with grievance."
"We will seek each unheeding heathen, see them bleed or plead allegiance." Idk where I'm going with this
Come back here and we'll feed you to our pets.
Someone delete this
how did
Hey guys, is it just me or new units don't attack units from other races anymore?
part of my 3d mod "thickens" sprites by instantiating the original spriteRenderer a number of times and setting the position
but if i delete those instantiated sprites, shadows are left over even though i dont copy those directly
is instantiate copying more than just the spriteRenderer object? i dont use instantiate enough to know whats going on
code in case it helps
i only directly copy the building sprite so why do i get shadows as well
the shadows are part of the sprite
they are a different spriteRenderer altogether
or were before this update, think they changed a bit
but somehow copying one copies both
Then they are the same spriterenderer
Its just saved in two different properties
You can compare the hashes if you want to make sure
C# not knowing how to use copy paste be like
And btw why do you have the loop twice
Seems like the same loop
Hmmm
So if you instantiate the building you get the shado too
What about i instantiating the shadow
first loop goes one direction, second loop the other
i thicken sprites with the original being in the center
yes, and i can try copying the shadow instead to see if its happening both ways
the screenshot before that is showing that this isnt the case
A spriterenderer is an object
You can save it in two different property
Do a test
Print both hashes to a console
And check if theyre the same
Oh wait
This is unity
Then it all make since
The building object is a parent object with the shadow as a child
You need to remove the child
im copying a seperate child, the building's sprite
My brain hurts now
right?? lmao
Why is this happening
it seems super strange, there has to be something im missing
like maybe instantiate copies the parent as well?
but that doesnt seem right
this is how building shadows are created
the actual building sprite is created before this
during the building creation i think
right
You just want to make sprites
and so far i think im not copying buildings
just somehow multiple components of them from one specific
Try instantiating a gameobject and add a spriterenderer to it
And then copy the sprite
Yea
Create qn empty object then add a spriterenderer component and copy the sprite there
hmm
hmm
Hmmm
after i add the component, how do i edit it immediately after lmao
the object wont have that component in its list
i feel like an idiot rn
ohhhh
i understand then
ill want to add something like SpriteRenderer clonedSpriteRenderer = newSpriteObject.AddComponent<SpriteRenderer>();
and edit that
Do it
Yes
got it, will finish and test
But it might be laggy
Eetswa
Eshay
but errored once and continued button presses do nothing
so i dont think its doing anything at all
not reproducing error, not working
this is new code im at
Lol
these sprites dont show up at all
You dont move the spriterenderer
You move the object
And make the list a list of objecta
i move the renderer in current version already
You have to move the ibjwct
unedited version that works but produces shadows
Yea i know
#orange_eats_babies
#orange_eats_babies
right
Then you have to make it a list of gameobjectw
Because if u delete only the spriterenderer
You will have alot of empty objectw
i mean
mean
i have to make these objects work before i worry about cleaning them properly
Wait

Do trees count as buildings
yes, so this is creating and attaching sprites to new objects based on those trees
but theyre fucking massive and dont count as buildings so 3d isnt rotating them
progress tho
trees count as buildings
the ones you see in that screenshot that are bugged are not buildings, theyre GameObjects with spriteRenderer components only
Yes i know
These are the ones we made
You probably need to scale them right
Try scaling them to 0.1
Btw you should probably not delete them and reinstaniate them evertime
That might cause lagg
this is not working
its got the same bug the lineRenderers i used before has
ignoring the scale, these clones look good from this angle right
but any time the world is rendered, those new renders are stuck behind it
What are you trying to accomplish with your mod
this particular feature or the whole thing
Xd
So youre rotating everything to make the game feels 3D
You probably need to rotate the copied trees too
yes, this is one version of 3d in my mod, everything is repositioned and rotated to give a paper standup feeling
Do you still live in a shed
but then the feature being worked on right at the moment is for taking one of those paper feeling buildings
and thickening it
copying its sprite and cloning it several times, putting it right beside the original
can see the thickened effect versus what it normally looks like
Yea
and this works perfectly as i intend, until deletion when shadows are somehow left
when i didnt clone them in the first place
hey hamza
Hi
since maxim gave me a challenge i do something else than the 2d thing
i do a tic tac toe
but i got a weird error and i can't figure out how to get rid of it

in a file called
Main.cs
i have this
void Awake()
{
_board.Build(this);
}
the content of the awake function is line number 15
error ```NullReferenceException: Object reference not set to an instance of an object
Main.Awake () (at Assets/Scripts/Main.cs:15)
but
this is actually refering to the class
so i don't understand how i get this error
i still got the error
Send the error again
NullReferenceException: Object reference not set to an instance of an object
Main.Start () (at Assets/Scripts/Main.cs:15)
i did it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Main : MonoBehaviour
{
public Board _board;
private bool _XTurn = true;
private int _TurnCount = 0;
void Start()
{
_board.Build(this);
}
public void Switch()
{
_TurnCount++;
_XTurn = !_XTurn;
}
public string GetTurnCharacter()
{
if(_XTurn)
{
return "X";
}
else
{
return "O";
}
}
}
and my Board is :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Board : MonoBehaviour
{
public GameObject _cellPrefab;
private Cell[] _cells = new Cell[9];
public void Build(Main main)
{
for(int i = 0; i <= 8; i++)
{
GameObject newCell = Instantiate(_cellPrefab, transform);
_cells[i] = newCell.GetComponent<Cell>();
_cells[i]._main = main;
}
}
}
why
You know python right ?
yes
Lets say i have a class named Boo
yes
jest
Here its the same
You want to make an object
You do Boo obj = new Boo();
The syntax is different
But its the same
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
wdym
Drag the script to your object in the inspector
Just like you added the main script
yes
And its supposed ro have 9 cells
with a grid layout group
PR_Cell
yes
Public Gamobject Board
ok done
Private Board _board
Then how are you getting the error if main.cs is not executing
cuz the main is called by the cell
Send cell.cs
i think
Are you following a tutorial
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Cell : MonoBehaviour
{
public Text _label;
public Button _button;
public Main _main;
public void Fill()
{
_button.interactable = false;
_label.text = _main.GetTurnCharacter();
_main.Switch();
}
}
??
i was but i stop on everything to understand what i'm doing
cuz it's useless for me to just follow a tutorial
i also have a very bad memory
This is a bad tutorial xD
Tic tac toe
Has nothing to do with unity
So unity should be used as an interface
Idk why this guy is using monobehavior scripts
maxim told me to do one so i can learn basic stuff lol
Ol
K
I suggest you start over
And make only 2 scripts
One statix class that handles the game
And one monobehavior that draws the game
You dont need anything more
If you're following the tutorial correctly and you got that
Then it was a bad tutorial
And very confusing
it worked on his thing
and yes
it confused me a lot
especially when i think that the error is due to the this Keyword
anyway i think i'll follow other tutorials, many different stuff
In python
and go back to u if i'm really stuck i don't want to disturb you
and also don't want to be too dependent to other

what about this 
That might make it easier
You dont have to
Just a simple console
Once you get the game logic in unity
Its not that hard to turn it into a visual interface
i mean i have the game logic
i already have an idea on how to do it in python
and i know how to do it
You have to think about board games this way
Play -> check for wins or draws -> switch -> repeat
This is the ge logic
yes
I didnt see any state checks
anyway
i clear my prject
i have found an interresting on google
talking about the 2 script you told me

No problem
I read the GetField command as Garfield and was very interested for what it might do 
It eats lasagna
Eats the lasagne gameobject and if there is no lasagne it gives you nightmares
Where do I have to report bugs?
coding

Anyway so
Uhhh
I wonder how many people here prefer to use floats then ints even when they know the number will always be full
Im definitely one of those people
So, I Just noticed the way That the Worldbox dev. Fight back Dropping frame rates is by removing the entitie in the"Scene" but not deleting there whole data
Are they just compressing the data?
Maybe they get updated less
precisions 
also type casting?
since they probably gonna pass it to something else that takes float instead of int
Wasting memory ahhh yes
Actually now that I think about it I have been using floats way less because of the intRange script
It yea you also waste memory
well
Not to forget
Its in all languages
well frick
It just happens at different places
In python it can happen in simple math
In C# it has to be more complicated
use python with c extension

super extra hell
you can crash the interpreter with just a small mistake in making custom typed object
fair enough
Unless its a small part of your code that you eant to run faster
when you compile your code and it have 0 errors: 
Tru
The average amount of errors my scripts have is probably about 3
The problem is that's not just in the development stage, it's also in the finished stage
people when they didn't get any error: 
people when they get error: 
ah like production
yeah no frick that
i deploy instantly to production

the average amount of errors in my mods is unreal
I agree
Did it work ?
no
Xd
im still stuck, just woke back up lol
i think ill just keep the damn shadows for now and find a workaround to delete them later
Does it look bad with shadows
its obvious they shouldnt be there once you delete the other stuff
but no its not "bad"
Yea
Looks kinda thicc
Btw
I just thought about it
You have 2 loops
Shouldn't they be nested
Not nested should make textures look like
xx
X
Bested should ve more like
xx
xx
Doesn't leave gaps
no
gaps are filled by a different scaling value
and/or more layers
the two loops go in two different directions from the original sprite, forward and backward
and then theres 2 others for the other 2 directions, so i can thicken sprites normally and have a rotated thicc version
theres no reason to nest them
a better question is why im using <= in a for loop
for (int i = 0; i <= 5; i++)
higher i = more layers
changing distance scaling changes gap between layers
.q
@north dune i'm wondering
for modding
you just modify files without actually seeing what you do in real time
and then launch the game to test ?
without actually seeing what you do in real time
what do you mean by this
i mean, i can see the code im working with of course, but yes i have to compile and relaunch before seeing how it functions
In unity, you code what you do, you compile and you test in the game window
but
when you get worldbox
you can't turn it back into a unity project right ?
i can i think but thats not how i do things
most of the time you'd use DnSpy to open and make edits directly to Assembly-Csharp file
in my case i use bepinex to build a seperate file from everything, just using the games files as reference
and what Maxim and Mastef do in the inspector you can't acces them then ?
right, theres a few things they can do that i have no access to or even visibility for
cuz i'm wondering
let's say they lock the camera in 1 axis
no
they lock the camera rotation
like in the game already
considering i do change that with the 3d mod
nah
you can do almost anything
im not remembering off the top of my head what the inspector has that i dont
hmmm
lets say they override the angle constantly, which isnt the case in the game
i could find the code doing that and change it, remove it etc
feel free to ask however many you want lol
i already downloaded "many" mods
and their interfaces are always the same
is the interface done by unity or somethign ?
my mods are using unity's GUILayout system for convenience
i push other people to do the same thing
its purely for convenience, manually writing out menu positions or recreating a system entirely is just not worth it
ye
GUILayout looks bland but is amazingly customizable for how simple it is
it being simple is why my mods are all named... SimpleGUI

you may be interested in how bepinex/harmony works
considering I learned almost everything about modding from Cody, that's pretty obvious 
not atm 
i just wanted to know some stuff
cuz
now i'm learning some stuff on unity
instead of directly making changes to code in the source it does it a bit differently
i was just wondering
ahhh


Even decompilers dont decompile the code as its written
So its a bad idea to do it
Cody's way is probably the best way
The best way is for the devs to add support for mods
But they probably dont have time for that
there is an official mod loader
"experimental mode" in game is for that loader
i intend to swap over to it eventually, im just too comfortable with some of bepinex features
Hahahaha same

lel
Just wanna clear things up from around here from now on GetField is called Garfield
Oh really
Nice
Nice grammer
I wonder how yandere dev's spaghetti code tastes like
Spaghetti
how to change the color of the kingdom
@knotty root
#🚑help-chat is all you need 

UwU senpai coddy please teach me how to code c#
🗿 that sound really horrible
do you have to deal with pointers in C#?
I was just wondering as I've been learning about pointers in c++ today for like 1-2 hours
dont think so, ive never done it or seen any mention of them
yeah I was thinking that
pointers are cool tho
just frustrating to learn and to use sometimes
from what I've heard
I only have experience from learning
C# supports pointers in a limited extent. A C# pointer is nothing but a variable that holds the memory address of another type. But in C# pointer can only be declared to hold the memory address of value types and arrays.
still seems useful
int* ptr1 = &x;
what the hell
new syntax 
it is like:
int *ptr1 = &x;
in c++
the * placement is way too specific
it means multiplication if you place it poorly
lol

The use of pointers is rarely required in C#, but there are some situations that require them. As examples, using an unsafe context to allow pointers is warranted by the following cases:
Dealing with existing structures on disk
Advanced COM or Platform Invoke scenarios that involve structures with pointers in them
Performance-critical code
Apparently they aren't used a lot
(this was copied from stackoveflow lol)
the first 2 are just better to do with c/c++ lol
but if you need them in C# program yeah
Yeah you don't usually use pointers in c#
but sounds like rare use
Objects are automatically passed by reference
You have to use pointers a lot in c++ as far as I am aware
or well you could go without them (sometimes atleast) but they're way more clean to use and make code way faster (most of the time)
C# uses a lot of more abstraction than c++, that's why you can "forget" about some more technical and hardware related stuff and focus on the algorithm
yeah true
I remember using pointers, boy at first they were so confusing
they are at first but I've got used of looking at them
declaring objects tho
that is so fucking weird to me
and constant functions in objects
or just constants
those don't exist in python
Constants don't exist in python?
I always start to do:
ClassName = obj;
but it's just
ClassName obj;
atleast I've never stumbled upon them
In this tutorial, you will learn about Python variables, constants, literals and their use cases.

never knew
I've never used them anyway
They'd make code more readable tho
as you know what variables are never gonna change
but constant functions and classes
holy shit those are weird
I mean these
also function overloading is new to me
but it is super cool
yeah
Oh right I almost mixed it up with overriding
what's that
When the base class and derived class have member functions with exactly the same name, same return-type, and same arguments list, then it is said to be function overriding.
hmm
why would this be used
Do you know how inheritance works in Object Oriented Programming?
a little
Ok just a second they are calling me
I wonder who are they
It's them
Anyway
So basically when you inherit from a class, you can override a method and change how it works but I'm pretty sure you can't change what it returns and the parameters.
To make an example, we have class Car, that has a method public void Start() that makes the car.speed increase by 10.
We can make a FastCar class that inherits from Car, and by doing
public void override Start() we instead changed the speed by 20.
This is not the best example but it's the only one I could come up with :Tom:
Poop
Thanks I guess
Poop is good
The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.
So yeah you keep the same function signature, but the code inside the function itself can be changed
cool
I need to think of a project idea in C++
I want to do something with GUIs maybe
but Idk what
I have rare chance to code 10pm on my pc so I am using it to the max atm
my brother wants me to create app that has button that gives you random monke image
fuck it why not
yea
it would probably be harder to find enough images of monkeys then actually make the application lmao
Yea I’m a coder. Look at me code.
if
{Phallus} = stitched_shut
Then
{Climax} + 100 Agony
Just use an api that takes a word and gives a random image
Theres probably a ton of them out there
because this is windows specific: https://docs.microsoft.com/en-us/dotnet/api/system.windows.rect.parse?view=net-5.0
i had to make my own way to parse a string back into a Rect after i used ToString on it
but now after a couple hours, i can save and load menu positions despite Bepinex not supporting Rect in its config stuff
[Info : Unity Log] Loaded window position: 636, 0, 0, 0
how does the original string look like?
Saved main pos: (x:705.00, y:237.00, width:200.00, height:251.00)
after : is the Rect.ToString
simple stuff i think but was annoying
and all because the OG looks platform dependent
yeah
can't you rect.ToJson
and then just JSON.Parse(abc)
i dont use json
if i start using it i could swap stuff, this was done because bepinex config supports saving lots of types but just not Rect
i mean instead of this (x:705.00, y:237.00, width:200.00, height:251.00)
you get this {"x":705.00, "y":237.00, "width":200.00, "height":251.00}
and then it's easily parseable from anywhere
no need to reinvent the wheel then 
isnt parsing it the same either way
all i had to do was split it up
luckily this is the kind of thing i can do once and forget about lol
how bad of a practice is using lots of InvokeRepeating?
im up to 3 now and thinking i could avoid it if i needed
what type is rect
ah just Rect
string rectString = JsonUtility.ToJson(myRect);
Rect myRect = JsonUtility.FromJson<Rect>(rectString);


i think it's in traits loader or assetmanager as well
a more powerful json lib is used in save files
ive tinkered with it a tiny bit to help with a bot
json seems very convenient
i just havent swapped around lmao
think i was originally trying to parse online commands with json
yeah
but gave up quickly to go back to what i understand
i think json is one of the simplest online data structures, it was a blessing after xml
now that these positions are being saved im going to wind up unintentionally trolling people who move them off their screen to hide it

yeah
R resets everything else in my stuff so
like ctrl r for menu i guess
cant hit the GUI button to reset it if you move the GUI off the screen
fmp is the reason i thought about it at all lol
oh yeah
sure
can i go dm ?
ye
dying noisy
I finally fixed the last issue ahhh
i hate lists in C#
I've fallen in love with arrays
I kind of disliked arrays after we got into pointers with c++
You know stuff like looping through arrays with pointers
Very confusing
Shut
Don't you dare insult my precious lists
i hate them
I'm triggered
Easier doesn't always mean better 
^ facts
To my knowledge everything
What are you trying to reference
Random int? Number?
Or something else
Ah
Well it's more complicated then that
Ok so
A couple of messages ago I showed a script
Which is very useful
It's called IntRange
Basically it manages to get an int from a certain range
Lemme find the message
Ok
Here it is
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class IntRange
{
public int m_min;
public int m_max;
public IntRange(int min, int max){
m_min = min;
m_max = max;
}
public int Random{
get {
return UnityEngine.Random.Range(m_min, m_max);
}
}
}
Then you just reference it in another script
oh boi
In reality you don't need it
The command to return a random int in a range is just
Return UnityEngine.Random.Range(numberMin, numberMax);
An answer to this
You just use the class as it is
Random.
Instead of
Random rnd = new Random();
rnd.
Range instead of next




