#Explaining Code using GregTech Metaphors
1 messages · Page 1 of 1 (latest)
(Making a thread so it's all together)
So, you'd route your AE2 interface to the cleanroom, and you'd have a subnet that executes one Machine
You can think of running the Network Cable to the Cleanroom input as creating that public PlayerInput playerInput variable
hol on bro let me me rephrase my question in a gtnhish way
That's routing from your AE2 network to that cleanroom.
👀
Now, you have access to the cleanroom, and you want to run one machine in it.
right, or we can fill it up inside with pattern providers(i think they are addressed in code as functions)
So, let's say you want to make a circuit, and the first step you have in that chain is a wiremill, and everything pipes into the next thing so you only have to do that one thing to kickstart the whole assembly line. In code-ese, you'd be calling the Wiremill that is inside the cleanroom
yeah actually, i just realized how dumb my question actually meant
Creating the variable in one script is analagous to having a network cable to the cleanroom.
Calling a function on that variable is analgous to having the cleanroom input pipe into a machine inside it.
In this analogy, Update is basically when you have a machine passive'd. It's constantly receiving input from the network and putting its output back into the network. Like a machine that just has a single pattern provider pointing at it
You don't have to do anything to run it, it's just always going.
Consume iron, output plates
For Unity tips or for GregTech
this modpack is like 4-5k hours of gameplay
so imagine this code is my terminal
so i am passiving something, you give it the ingredients and it goes through the line, you dont just spam pattern providers in gtnh like you do in other modpacks, i want it to do the same, just basically. keep updating, if i have the avaible materials perform the line, but the problem is, i am unable to send the materials to the line, its connected to the network and is supplied with channels but its nor taking or recieving
Well, you've got your network terminal, but what's the Cleanroom doing? What's inside that? (Show the code for PlayerCamera)
1 sec let me undo the errors
So, looks like this process is completely passive. This is gonna work just fine without you needing to put any pattern providers anywhere
really?!. so how do i connect it to the network for it to start running, i gave it channel, but i think i am missing a interface or a pattern provider
As long as you've got this in your base somewhere, it's going to run fine (just put the PlayerCamera component on an object)
how exacly?
You'd just attach the component to the GameObject you want to be doing this
pretty sure it didnt work earlier but let me rety, 1 second
@alpine idol so it actually worked, but i am unable to interact with the serialized field, i am trying to drag a game object but its not possible
Which object are you trying to drag, and into which field?
its a empty object. i am just trying to drag it into a "transform" foeld
Are you trying to drag something from the scene into a prefab?
... sigh, please kill me
nvm
A prefab isn't actually in the base. It's a blueprint. You can't wire data into a blueprint
still doesnt work, evne tho i entered prefab mode
oh, let me rerty
still doesnt work, evne tho i am inside the prefab itself
Show a full screenshot of your unity window. What object has the PlayerCam script, and which object has the PlayerCamera script?
sure
and i am tryna drag the player camera position inside of the "playercam" game object
i cant see any embeds right now.. discord is being discord
Okay, does that object have the PlayerCamera script on it?
seems yes, why tf i cant send screensots anymore
Discord broke
let me restart
No, like, Discord broke
not your discord
Capital-D Discord
Welcome to Discord's home for real-time and historical data on system performance.
Might need to be.
Because it seems like your issue is the object you're dragging in doesn't have the script you're looking for attached
And if you say it is there, then I can't really continue until we've confirmed that
but i am guessing my problem is from the class itself, i am unable to configure the serialized field. maybe around that. anyways cya later
The serialized field of type PlayerCamera, right?
Is that the one you're taking about?
yeah
You would drag in an object that has the PlayerCamera component on it
Keep in mind - you've named them similarly, but PlayerCam is not PlayerCamera
We're back in business show the inspector of the object you're dragging in
i ma go to sleep soon, mb for lat ereply but let me set smth real quick
. check the name of the stuff so you dont get confused
but basically the box in the image, i cant drag shit into there for some reason
Show the inspector of one of the things you're trying to drag in
...you said this object had a PlayerCamera component on it
ah wiat
i thought you meant the object i wanna drag
1 sec
I did
That's why I asked for that one
That's the thing you're trying to drag into the slot right?
The slot that is looking for a PlayerCamera component
If you want to reference a PlayerCamera, you have to actually drag one of those in
holy shit
1 sec
here, i got this script
i just loaded 5 braincells
anyways i need to sleep,lets continue tmr
@alpine idol i finnaly figured a way to translate my problem into ae2
this is my main net
public FirtPersonMovement.PlayerCamera playerCamera; this is my storage bus on my subnet. it connect and i can view the items, but i cant drag and use the items
Well, that'd be a wire to the storage bus. It's a reference.
So, what storage bus are you connecting to that wire
Or, actually, I suppose you can think of this as a storage bus and the object you're referencing as the storage block itself.
So, I guess instead, show me the chest you're trying to connect to this
When last we left our heroes, we were trying to find the object you were trying to drag in as a reference
i kind of realized, i dont know what kind of object i am supposed to drag in....
You do though. This kind.
That's the type. FirtPersonMovement.PlayerCamera
yes, i made my class a variable visible in my unity editor, now what
so let me explain rq what does that class actually do. basically i put that script on a camera, usually i am supposed to drag smth in the player parent called, camera position
You have made a script with a variable that holds a reference to a PlayerCamera component. You can drag in any object that has that component on it
which i got none... i think i need to restate my question in a better way, the main question above all, i will say in the simplestway my brain can. you know how you type a script, simple, inside class, attach it to anything and it does what its supposed to(if the code is right) so i did that step. second step, i would like to convert that script, into something like a code block, i could just type a line of code and it brings that entire script over to the B script where i typed the 1 line. and the B script can simply be linked to the thing you want. in summary, i want 1 big ass code, filled with classes, that can be treated like a blocks, i just write 1 line of code bringing that entire class directly over here, no changes, nothing fancy, just that, is that possible or no
If you don't have anything with that script on it what are you trying to reference
The thing you're describing you want to do is just not how code works
oh, i see
Your scripts define a behavior that goes on an object and makes that object do the thing
I don't think any amount of metaphor is going to explain this, you seem to have a fundamental misunderstanding about how code works and what it is for. You should look at the pinned guides for how C# works and then try !learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!