If you use a wired keyboard, you can use almost any key (except alt, start, escape)
It spits out bytes, but its ok as toChar(97) == A
As in my last post, i made that fail, 30 second chip that lets you throw props. Problem being, a lot of servers only equip you with a phys gun and tool gun. since i have 3 "fire modes" in the chip (Throwing, Lifting, Stopping), i need three keys, and the only ones are Me:keyUse(), Me:keyAttack1(), Me:keyAttack2(). What i want to do is when i press E (Me:keyUse()), the e2 cycles through the three modes and when the mode changes, it prints that in chat. When i press right click(Me:keyAttack2()) that fire mode happens. Ex: your on "Lifting mode". right click is pressed and you lift the prop. You press E and it goes to Stopping mode. You press right click and you stop props in mid air. Heres the code i have so far, when I'm done ill release it for funnzies. i know, i know, this is a possibly mingey chip and its very noobish. well im not a practical coder, i dont solve problems, i have fun or make them.
Code:@name throwing props @persist Throwing Lifting Stopping runOnTick(1) It=entity():owner():aimEntity() if(first()){Throwing = 1,Lifting = 0,Stopping = 0} Me = owner() Mass = It:mass() if(Throwing==1&Me:keyUse()) { Lifting = 1 Throwing = 0 Stopping = 0 } if(Lifting==1&Me:keyUse()) { Lifting = 0 Throwing = 0 Stopping = 1 } if(Stopping==1&Me:keyUse()) { Lifting = 0 Throwing = 1 Stopping = 0 } if(Throwing) { print("now Throwing") } if(Lifting) { print("now Lifting") } if(Stopping) { print("now stopping") } if(Throwing == 1&Me:keyAttack2()) { It:applyForce(Me:eye()*It:mass()*10000000) It:setMass(9001) } else { It:setMass(Mass) } if(Lifting == 1&Me:keyAttack2()) { It:applyForce(((It:pos() + vec(0,0,135))- It:pos())*It:mass()-It:vel()*(It:mass()/3)) } if(Stopping == 1&Me:keyAttack2()) { It:applyForce(((It:pos() + vec(0,0,9))- It:pos())*It:mass()-It:vel()*(It:mass()/3)) }
[TEC] SnowstormFox: failure is not a option, it is a mission :3
If you use a wired keyboard, you can use almost any key (except alt, start, escape)
It spits out bytes, but its ok as toChar(97) == A
.siht daer ot gniyrt emit detsaw ev'uoY
i know, i was thinking of using a wire keyboard, but i dont think you can move around while using one, can you?
[TEC] SnowstormFox: failure is not a option, it is a mission :3
Go into the weapons tab and get out the Remote Control. It doesn't do anything if it isn't linked to a pod, so it should work for 99% of cases in which you need to use keyattack1/attack2/use().
ya, i could use a remote control but the server i play on has it blocked for some apparent reason. i still think it would be cool to have a cycle sorta system.
[TEC] SnowstormFox: failure is not a option, it is a mission :3
I remember a thread about a noweapon weapon coming out on loadout made for wiremod and e2 and etc.
I know that plenty would support it, and I know a lot have talked about it on the forum and to me personally.
Here's a quick bit of psuedocode to give you a idea.
if (ChangeMode) {Mode = Mode + 1}
if (Mode > 3) {Mode = 1}
if (Mode < 1) {Mode = 3}
if (Action & Mode = 1} {Action1}
if (Action & Mode = 2} {Action2}
if (Action & Mode = 3} {Action3}
That code looks annoying...
Now just use an if statement like "if Mode==0 {stuff with lifting code}"Code:-snip-
yada yada yada, you know the drill ^^.
EDIT: With my new knowledge, I know this would not work, due to E:keyAttack1/2() being weird. Look at page 2 for code that works.
Last edited by ktccd; 03-13-2010 at 03:59 PM. Reason: Error and update.
Eh? Could you please explain how this works because I must be missing something here... Anyway what tepholman said should work except you might want to use if(ChangeMode & ~ChangeMode) so you can't scroll past two options in one click if the chip is running frequently and also you don't need "if (Mode < 1) {Mode = 3}" if you only have one button to scroll up![]()
Here's my Telekenesis chip. Look closely at how the chip knows when to grab, let go, throw, and move the prop. (hint: Use key and a persisted variable.)
Code:@name Telekenesis (Stand Alone) @persist Telekenesis HoldMod Mouse1 Mouse2 Dist @persist TargEnt:entity O:entity @persist Direc:vector runOnTick(1) interval(10) Own=owner() if(first()){O=owner()} Said=Own:lastSaid() SaidWhen=Own:lastSaidWhen() Splode=Said:explode(" ") Use=O:keyUse() Mouse1=O:keyAttack1() Mouse2=O:keyAttack2() Mouse1C=changed(Mouse1) Mouse2C=changed(Mouse2) Weapon=(O:weapon():type()=="weapon_crowbar" | O:weapon():type()=="weapon_physcannon" ? 1 : 0) if(Use&Mouse1&Mouse1C&!Telekenesis&Weapon) {Telekenesis=1,TargEnt=O:aimEntity()} elseif(Use&Mouse2&Mouse2C&Telekenesis&Weapon) {TargEnt=noentity(),Telekenesis=0} elseif(Use&Mouse1&Mouse1C&Telekenesis&Weapon) {TargEnt:applyForce(Direc*5000),TargEnt=noentity(),Telekenesis=0} if(Telekenesis&clk("interval")) { Direc=O:eye()*100 Pos=TargEnt:massCenter() EyeMod=Direc:length()+HoldMod HoldPos=O:shootPos()+O:eye()*EyeMod Dist=O:shootPos():distance(Pos) PVel=TargEnt:vel() OVel=O:vel() OAVel=O:angVel() PAVel=TargEnt:angVel() Mass=TargEnt:mass() Inert=TargEnt:inertia():length()/sqrt(3) TargEnt:applyForce(((HoldPos-Pos)*10-PVel+OVel)*Mass) TargEnt:applyAngForce(-(TargEnt:angles():setYaw(0)*25 + PAVel*2)*Inert) } elseif(TargEnt==noentity()|Telekenesis==0){Telekenesis=0,HoldMod=0} if(Mouse1&Telekenesis){HoldMod+=1} if(Mouse2&Telekenesis&Dist>=100){HoldMod-=1} if(Splode[1,string]=="!Teleken"&changed(SaidWhen)) { if(Splode[2,string]:lower()=="me"){O=owner()} else{O=findPlayerByName(Splode[2,string])} }
Bookmarks