#Explaining Code using GregTech Metaphors

1 messages · Page 1 of 1 (latest)

alpine idol
#

(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

bitter quarry
#

hol on bro let me me rephrase my question in a gtnhish way

alpine idol
#

That's routing from your AE2 network to that cleanroom.

spare topaz
#

👀

alpine idol
#

Now, you have access to the cleanroom, and you want to run one machine in it.

bitter quarry
#

right, or we can fill it up inside with pattern providers(i think they are addressed in code as functions)

alpine idol
#

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

bitter quarry
alpine idol
#

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.

alpine idol
#

Consume iron, output plates

spare topaz
#

im gonna have to refer to this thread later..

#

this is a good analogy

alpine idol
bitter quarry
#

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

alpine idol
alpine idol
# bitter quarry

So, looks like this process is completely passive. This is gonna work just fine without you needing to put any pattern providers anywhere

bitter quarry
alpine idol
#

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)

alpine idol
bitter quarry
#

@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

alpine idol
bitter quarry
alpine idol
bitter quarry
#

nvm

alpine idol
bitter quarry
#

still doesnt work, evne tho i entered prefab mode

bitter quarry
#

still doesnt work, evne tho i am inside the prefab itself

alpine idol
bitter quarry
#

and i am tryna drag the player camera position inside of the "playercam" game object

spare topaz
#

i cant see any embeds right now.. discord is being discord

alpine idol
bitter quarry
#

seems yes, why tf i cant send screensots anymore

alpine idol
bitter quarry
alpine idol
#

No, like, Discord broke

#

not your discord

#

Capital-D Discord

bitter quarry
#

oh-

#

anyways, we continue this convo later?

alpine idol
#

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

bitter quarry
#

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

alpine idol
#

Is that the one you're taking about?

alpine idol
#

Keep in mind - you've named them similarly, but PlayerCam is not PlayerCamera

alpine idol
#

Okay image uploads are back.

alpine idol
bitter quarry
#

. 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

alpine idol
bitter quarry
alpine idol
bitter quarry
#

i thought you meant the object i wanna drag

#

1 sec

alpine idol
#

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

bitter quarry
#

holy shit

#

1 sec

#

here, i got this script

#

i just loaded 5 braincells

#

anyways i need to sleep,lets continue tmr

bitter quarry
#

@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

alpine idol
#

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

bitter quarry
#

back... my life has been quite busy @alpine idol

#

anyways lets resume

alpine idol
#

When last we left our heroes, we were trying to find the object you were trying to drag in as a reference

bitter quarry
alpine idol
#

That's the type. FirtPersonMovement.PlayerCamera

bitter quarry
alpine idol
#

That's the thing you want to drag in

#

So drag in one of those

bitter quarry
#

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

alpine idol
bitter quarry
# alpine idol You have made a script with a variable that holds a reference to a `PlayerCamera...

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

alpine idol
#

The thing you're describing you want to do is just not how code works

alpine idol
#

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

shut oakBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!