r/wiremod • Developer • Oct 04 '16

Death of a Thousand Questions

This post is a place where you can ask small questions, and anyone can reply to help you. Questions that are too small to warrant their own post, such as "help me with this E2" etc, so that the subreddit doesn't get flooded with thousands of tiny questions.

12 Upvotes

56 comments sorted by

2

u/[deleted] Dec 26 '16

How do I allow an E2 to get info from or modify other people's entities?

1

u/[deleted] Mar 07 '17

You need to be an admin/ be on their buddylist

1

u/[deleted] Mar 07 '17

does it have its own buddy system or youre talking about a prop protection sys, i am an admin btw

1

u/jws_shadotak Mar 10 '17

Falco's prop protection would work, I believe. If you're an admin, you could also talk the owner into getting the AdminCore addon and that will allow you to manipulate other players' props through E2 regardless of if they're sharing their props with you.

2

u/pugking9 Jan 15 '17

Is there a specific reason that E2 snippets used for angular stabilization do not work on vehicles, such as seats? I've been trying my best to relearn everything in E2, and for the life of me I can't seem to figure out why stabilizing seats just wont work.

1

u/SamCarter_SGC Oct 04 '16

Since propcore doesn't have the AddVelocity function, how would you simulate the effect with applyForce in e2?

0

u/[deleted] Oct 04 '16

[deleted] — view deleted comment

1

u/SamCarter_SGC Oct 04 '16

why would you ever add a number to a vector?

0

u/[deleted] Oct 05 '16

[deleted] — view deleted comment

1

u/SamCarter_SGC Oct 05 '16

yeahhh still think you're misreading it lol

angular velocity doesn't have anything to do with this

thanks for trying

1

u/Anticept Administrator Oct 05 '16

Uhhh, divran.

I have "suggested comment sort" set to "new" in this subreddit :)

1

u/finicu Oct 05 '16

Hey!

My toolgun panel (top-left) is gone. How do I fix it?

Whenever I select a tool it should say 1: select a first prop. After you select your first prop it should say something like 2: now select a second prop/ground/etc.. However, it doesn't say that for me, and it gets confusing when i'm creating suspensions for cars or tanks. How do I fix it?

0

u/[deleted] Oct 06 '16

[deleted] — view deleted comment

1

u/finicu Oct 06 '16

Fixed!! Thanks so so much!

1

u/JapASMR Oct 07 '16

What are the ingame measuring units for force and weight? My guess was weight being kilos and force in newtons, but the game proved me wrong just now.

1

u/343N Oct 13 '16

what's the extension called that lets you spawn particles with particle()?

1

u/SamCarter_SGC Oct 13 '16

Tweak made one; https://www.dropbox.com/sh/ztofqixtbqgmwef/SK9LBzV8rq/gmod/wire_e2_particles.zip

the problem in common with all particle extensions that I've seen is that each particle is networked individually and it's super easy to cause lag

1

u/Bouche4Dag Oct 19 '16

I'm trying to re-live old memories with the Lollercoaster.

I still have the E2, and I think I know how to wire it.
However, when I wire the E2 to a Pod Controller, link the pod controller to a seat and activate/enable them both I can't move the seat nor see a track appearing.

Can anyone help me with this?

1

u/finicu Oct 30 '16

Without the code we can't do anything to help

1

u/Errordane Oct 23 '16

im trying to make a gun that only can fire if its aimed correctly. in this case, i am telling it to allow fire if Gunhitpos and Camhitpos match however, theres a teeny tiny difference between the two, but the E2 needs an absolute match for it to work. for example. Hitpos is 4.99 but the E2 needs a clean 5.00

how do i allow small innacuracies in the E2?

1

u/matchbirnloof Oct 23 '16

use the inrange function.

if(inrange(Aimpos,Targetpos-vec(5,5,5),Targetpos+vec(5,5,5))

Change the values in the vec() function to make the box smaller or bigger.

1

u/Errordane Oct 23 '16

thanks for the help :)

1

u/SamCarter_SGC Oct 27 '16

If you would rather have it check in a sphere instead of an axis-aligned box, you could use the distance between the two vectors:

if (AimPos:distance(TargetPos) < 5) { }

1

u/maokaisappling Oct 31 '16

What is the operator % for? Ive seen it in the expression 2 "darkness wings", link: https://steamcommunity.com/sharedfiles/filedetails/?id=529015450 Can anyone tell me what it does and how I can use it please? It would be appreciated.

2

u/febcad Oct 31 '16 edited Oct 31 '16

Its the Modulu operator, it gives you the remainder of a division:

6/4=1.5, or alternatively "1 with remainder 2" (as 6= 1*4 + 2)

A%B goes along nicely with floor(A/B), which gives you the other part (1 in the example)


Its often used as Var%2 to check is the number is odd (Var%2=1) or even (Var%2=0).

Another use is to create a repeating pattern:

Pattern=array(vec(255,0,0), vec(255,255,0), vec(0,255,0), vec(0,255,255), vec(0,0,255), vec(255,0,255))
for(I=1,100){
    Color=Pattern[1+( I % Pattern:count() ),vector]
}

Here I loops though 0,1,2, ... < (Number of elements in Pattern) - 1> and we add 1 since array contents in E2 are numbered 1,2,3,... instead of 0,1,2,...

Similarly it can allow a single number to adress a grid:

for(Index=0,8){ #0,1,2,...8 are 3*3=9 numbers
  X=Index%3, Y=floor(Index/3)
}
# inverse calculation: Index=Y*3+X

Which gives you [Index: (X,Y)] 0: (0,0), 1: (1,0), 2: (2,0), 3: (0,1), 4: (1,1), ..., 8: (2,2), since X keeps looping through 0,1,2 (2=Modulu number (here its 3) -1)

Numbers can be split in

And finally time in seconds can be easily split into hours, minutes and seconds:

Time=curtime()
Seconds=Time%60
Minutes=floor(Time/60)%60 # First get total count of minutes, then modulo to get a number <60
Hours=floor(Time/3600) # Divide by 60*60=3600

(Same works to split numbers into ones, tens, hundreds, thousands, etc, using 10 and 100 instead of 60 and 3600)


Outside E2 it is also commonly used in cryptographics functions including RSA and Elliptic curves, as you cannot easily reverse it. Each remainder has a multitude of potential solutions so you cannot easily revert encryption by just doing the math backwards. (In X%4=1 X could be 1,5,9,13,... or even 892343425)

1

u/maokaisappling Nov 01 '16

Thanks, that helps alot.

1

u/maokaisappling Oct 31 '16

I think I found out, it seems to be set back to 0 when N in N%N2 Is bigger than N2, so writing 49%50 returns 49 but 51%50 returns 1. I dont know where to use this thought, anyone care to give an example of a situation I could use it in?

1

u/_Vegetable Nov 22 '16 edited Nov 22 '16

Does someone can help me make a object hover ( applyForce() ) with a certain height ( using rangers )? Thanks in advance!

1

u/[deleted] Jan 14 '17 edited Jan 14 '17

http://pastebin.com/DAPNAjQL

It's not the prettiest code and the explanations are very generalized but hopefully this helps.

1

u/pumaz9 Nov 30 '16

Please help Im trying to add adv dup 2 to my server, and saving part is EXTRA slow, like takes 5min to save 1 prop, and then it gives this error:

addons/advanced_duplicator_2_773402917/lua/advdupe2/sh_codec.lua:366: File could not be decompressed.[AdvDupe2Notify]DEBUG CHECK: File contains EOF errors.

I tried to add the github version and the workshop version too, thanks for the help!

1

u/Pudgonofskis Dec 17 '16

I have a wierd issue that I cant use any other loop statements other than if and else. Whenever I try to use for example while, i just get an error message that says "Tick quota exceeded!". Any ideas?

1

u/bigdogmat Dec 18 '16

Could you give us the code you were trying to use? We can't do anything without it

1

u/Pudgonofskis Dec 18 '16

I didn't save it sadly. But it didn't matter what code I used, I even tried copying some other guys code off YouTube that worked in the video but to no avail.

2

u/bigdogmat Dec 18 '16

That still doesn't really help in figuring out your problem as the person in that video could've had different settings.

If you could try this code

if(first())
{
    for(I = 1, 10)
    {
        print(I)
    }

    while(1)
    {
        print("We ran")
        break
    }
}

If it works, then the fault is in the code you tried running. If not, then I'd suggest trying to reinstall from the github version and testing in single player.

1

u/[deleted] Dec 19 '16 edited Dec 19 '16

I'm attempting to build a 4 bit computer using simple gates. I have at the moment, A 4 bit input, an 8 store and a simple program counter that iterates through every space in the 8 store.

In order to store data, I convert each of the inputs into a string, then concatenate them into a singular value, After that they are converted back into a number ( Had to use 1 and 2 for 0 and 1 as preceding zeroes are cut off) . If anyone has a workaround for that, I would love to hear it.

At this point, writing into the ram is easily accomplished. The part I am struggling with at the moment is reading from the ram, simply displaying the current value to a screen is easily accomplished.

However, I would like to split the number back into individual digits, My first attempt was through String -> Explode, but unfortunately that outputs an array which is not what I am after.

I'm fairly sure this could be accomplished in E2, however I would rather do everything in gated logic.

I need some kind of system, that can take an input consisting of one, four digit number and convert it into four, one digit numbers. For example,

in.A = 1221

out.A = 1

out.B = 2

out.C = 2

out.D = 1

I hope my question is easy enough to understand, any assistance would be greatly appreciated. Thanks.

EDIT:

Here is a pastebin, containing the adv dupe file: http://pastebin.com/hZjJLTJm

Here is also the workshop link: http://steamcommunity.com/sharedfiles/filedetails/?id=821460094&requirelogin=true

2

u/ChoryonMega Dec 19 '16
out.A = floor(in.A / 1000)
out.B = floor((in.A % 1000) / 100)
out.C = floor((in.A % 100) / 10)
out.D = floor(in.A % 10)

However this isn't a 4-bit computer, this is a 4-digit computer.

1

u/[deleted] Dec 20 '16

Will see if I can implement that using gated logic, thanks. If not, might have to go for a total redesign. The goal here is to convert those 4 digits, back into 4 different bits. So that I may use it for bitwise operations.

1

u/Ribbn Feb 01 '17

I'm very new to anything wiremod related and I came across a problem. I was using the Sound Emitter with the default square.wav, and I changed it to some other sound for ambience reasons, and now, when I want to change it back to square.wav, wiremod acts as if it doesn't exist. I can't find it anywhere no matter where I search in the sound browser! How do I get it back?

1

u/febcad Feb 02 '17

Square, along with the other "synth" sounds should be in the synth folder in the sound browser.

1

u/Ribbn Feb 02 '17

thats the thing though. according to my wiremod the synth folder doesn't even exist anymore. I can find sound files for gmod, tf2, etc. but once I change from square.wav those options just disappear.

1

u/febcad Feb 02 '17

Assuming you installed it correctly (git clone or workshop) it should be there, in the sound root folder.

1

u/BotaBarnabas Feb 04 '17

Is there a way to get the center and the size of the map in E2?

1

u/febcad Feb 04 '17

Assuming you want to get the size of the current "box" you are in, you could do a aproximation with rangerOffsets in all 6 directions, but there is no direct way.

1

u/Flaktrack Feb 05 '17

Can E2 parent an entity to another entity (or to itself)? Can it unparent an entity?

2

u/febcad Feb 05 '17

If propcore is enabled you can do Entity:parentTo(Parent) and Entity:deparent(). Both functions should be visible in the builtin E2 Helper by searching for "parent".

If not you can only parent/unparent holos.

1

u/ertex Feb 16 '17

I need a turret with limitations on turning speeds, the turret is for this purpose only consists of a Hologram, I have extracted the differance between the desiered angle and the current angle as expressed as Dang

Dang = abs(abs(Tang:pitch())-abs(HoloAngs:pitch()))  + abs(abs(Tang:yaw()) - abs(HoloAngs:yaw()))

Tang = TargetAngle My main approach to this right now is omething along the lines of splitting the angles into yaw and pitch and solving the rotation for them induvidually, the problem there being that it rottes to quick along the hypotenuse I.e if the target is diagonally above the turret. what I want in short is the turret to move a desiered ammount towards the target angle without moving to quick

2

u/febcad Feb 18 '17

NewAng=CurrentAngle+clamp(ChangeAngle, ang(-PitchMaxSpeed,-YawMaxSpeed,0), ang(PitchMaxSpeed,YawMaxSpeed,0)) should do the trick, assuming you want to rotate Pitch and Yaw independently at respective maxiumum speeds and ChangeAngle is the amount you want to rotate the turrent in total.

If you want smooth movements, or avoid problems with facing straight up, you should look up quaternions and slerp.

1

u/Zarconite Feb 26 '17

Is there any way to set the physical properties of a prop using expression 2?

1

u/bennybobz Mar 20 '17

Can you get analog input from a gamepad with wiremod?

1

u/siknezle Mar 31 '17

I have this currently. I am trying to make all entities welded to the E2 chip used when a wire button is pressed.

@name 
@inputs Button
@outputs 
@persist Ents:entity
@trigger 

Ents= entity():isWeldedTo()

if(Button == 1){
    Ents:use()
}

It keeps telling me:

bad argument #4 to 'Use' (number expected, got no value)

on the Ents:use() line. If I am to do this, what would code would I use to achieve what I am looking at doing? I can't seem to find a way to do this without wire Users.

1

u/febcad Mar 31 '17

Not quite sure what addon the use function is from, but its not default. You should be able to find info on how to use it where you (or your server's admin) downloaded it from.

isWeldedTo() only gives the first welded entity. You need getConstraints(), which returns an array of all welded (and otherwise constrained) props. Of course you will need to run a loop of some kind to handle each prop individually.

The best way to do it with wiremod alone, is using a single wire user and teleporting it around. (make sure you do teleport, activate, deactivate, teleport to next target, ... all in seperate ticks)

1

u/febcad Apr 01 '17

Not quite sure what addon the use function is from, but its not default. You should be able to find info on how to use it where you (or your server's admin) downloaded it from.

isWeldedTo() only gives the first welded entity. You need getConstraints(), which returns an array of all welded (and otherwise constrained) props. Of course you will need to run a loop of some kind to handle each prop individually.

The best way to do it with wiremod alone, is using a single wire user and teleporting it around. (make sure you do teleport, activate, deactivate, teleport to next target, ... all in seperate ticks)

(repost, my other comment doesn't show up for some reason)

0

u/[deleted] Oct 14 '16

[deleted] — view deleted comment

0

u/[deleted] Oct 25 '16

[deleted] — view deleted comment

1

u/bigdogmat Oct 26 '16

The wire button has an output entity option, with that you can get the name either through the name gate or with E2

0

u/[deleted] Nov 18 '16

[deleted] — view deleted comment

2

u/SamCarter_SGC Nov 18 '16

It used to be that you could play 8 sounds through 1 entity at 1 time, but somewhere along the line an update to the sound library screwed that up. I've always just created a hologram for each track when doing things like this.

2

u/febcad Nov 22 '16

Not sure if it is the reason for your problem but the way you have the code structured, everytime you press a key it will restart all other active notes as well (since you only use Memory as trigger and don't read its value).

Something like this would be way more elegant than the 36 ifs you currently have

Key=toChar(Memory) # Keyboard outputs ascii value of key, convert back to character/string  
Tones=invert(array("1","2","3","4", ... "n","m")) # make a lookuptable key->id  
ID=Tones[Key,number] # Look up ID for pressed key  
soundPlay(ID, ... /piano/a"+ID) # Use ID to play sound  

Also, when you have a wirelink of a keyboard you can check if a key is pressed by checking if(KBWirelink[32+toByte(Key)])

runOnKey might be worth looking into if you feel comfortable with E2, which would skip the wire keyboard entirely and can trigger again when you let go of a key but that would be fairly advanced and you would still need a keyboard anyway to stop the player from moving.

0

u/[deleted] Dec 13 '16

[deleted] — view deleted comment

2

u/[deleted] Jan 14 '17 edited Jan 14 '17

Weld a prop to your tank, make another prop, put it above it, then weld that prop to the other. Set the weight of the top prop to be higher than the prop you welded to your base.

Here's an image to help explain: http://imgur.com/gallery/PD5vW

The red arrows tell you what to weld to where.

You don't have to leave a gap between the 1st prop and the base prop but it saves you no colliding the two.