User File #34924522240897332

Upload All User Files

#34924522240897332 - Chameleon Twist lua

Chameleon Twist (USA) gui.lua
1061 downloads
Uploaded 11/11/2016 7:38 PM by TASeditor (see all 188)
Nothing special, mostly basic stuff and hitboxes.
TODO: Move the graphics into a seperate window and add more stuff.
vx = 0;
vy = 0;

client.SetGameExtraPadding(0, 0, 320, 0)
Xdraw = 480;
Ydraw = 120;
Mouse = {};
ML = false;
ML_old = false;
showText = true;
MX=0;
MX_old=0;
Zoom = 1;

function ObjectView()

	gui.clearGraphics()
	
	--Player
	
	local xpos = memory.readfloat(0x174C2C, true)
	local ypos = memory.readfloat(0x174C30, true)
	local zpos = memory.readfloat(0x174C34, true)
	
	local xposprev = memory.readfloat(0x174C38, true)
	local yposprev = memory.readfloat(0x174C3C, true)
	local zposprev = memory.readfloat(0x174C40, true)

	local xspeed = memory.readfloat(0x174C4C, true)
	local yspeed = memory.readfloat(0x174C50, true)
	local zspeed = memory.readfloat(0x174C54, true)

	local yangle = memory.readfloat(0x174C64, true)
	local xyspeed = memory.readfloat(0x174C68,true)
	local xzacceleration = memory.readfloat(0x174C6C, true) 

	local radius = memory.readfloat(0x174C74, true)
	local height = memory.readfloat(0x174C78, true) 

	--local In air flag? = 0x174C7F b

	--local jumped flag? = 0x174C83 b (0x174C7F==1 && ~B) => 0x174C83 := 1

	--local air timer? = 0x174C87 b
	
	gui.drawEllipse(Xdraw-radius*Zoom, Ydraw-radius*Zoom, radius*2*Zoom, radius*2*Zoom, 0xFFFF0000);
	gui.drawPixel(Xdraw, Ydraw, 0xFFFF0000);
	gui.drawLine(Xdraw, Ydraw, Xdraw+math.cos(yangle*math.pi/180)*radius*Zoom, Ydraw-math.sin(yangle*math.pi/180)*radius*Zoom, 0xFFFF0000);
	gui.drawPixel(Xdraw+math.cos(yangle*math.pi/180)*radius*Zoom, Ydraw-math.sin(yangle*math.pi/180)*radius*Zoom, 0xFFFFFF00);
	
	--Tounge
	
	for i = 0, 0x1E, 1 do
		
		t_relx1 = memory.readfloat(0x175100+4*i, true)
		t_rely1 = memory.readfloat(0x175188+4*i, true)
		t_relz1 = memory.readfloat(0x175208+4*i, true)
		
		t_relx2 = memory.readfloat(0x175104+4*i, true)
		t_rely2 = memory.readfloat(0x17518C+4*i, true)
		t_relz2 = memory.readfloat(0x17520C+4*i, true)
		
		
		gui.drawLine(Xdraw+t_relx1*Zoom, Ydraw+t_relz1*Zoom, 
		Xdraw+t_relx2*Zoom, Ydraw+t_relz2*Zoom)
	end
	
	--Objects
	for i = 0, 0x30, 1 do
	
		local obj_type = memory.read_u8(0x176AEB+0x174*i)
		
		if obj_type ~= 0
		then local obj_xpos = memory.readfloat(0x176B0C+0x174*i, true)
			 local obj_ypos = memory.readfloat(0x176B10+0x174*i, true)
			 local obj_zpos = memory.readfloat(0x176B14+0x174*i, true)
			       
			 local obj_xspeed = memory.readfloat(0x176B18+0x174*i, true)
			 local obj_yspeed = memory.readfloat(0x176B1C+0x174*i, true)
			 local obj_zspeed = memory.readfloat(0x176B20+0x174*i, true)
			       
			 local obj_scalexz = memory.readfloat(0x176B24+0x174*i, true)
			 local obj_scaley = memory.readfloat(0x176B28+0x174*i, true)
		           
			 local obj_radius = memory.readfloat(0x176B48+0x174*i, true)
			 local obj_height = memory.readfloat(0x176B4C+0x174*i, true)
		           
			 local obj_yrot = memory.readfloat(0x176B78+0x174*i, true)
	               
			 local obj_viewx1 = memory.readfloat(0x176BDC+0x174*i, true)
			 local obj_viewx2 = memory.readfloat(0x176BE0+0x174*i, true)
			 local obj_viewy1 = memory.readfloat(0x176BE4+0x174*i, true)
			 local obj_viewy2 = memory.readfloat(0x176BE8+0x174*i, true)
			 local obj_viewz1 = memory.readfloat(0x176BEC+0x174*i, true)
			 local obj_viewz2 = memory.readfloat(0x176BF0+0x174*i, true)
			 
			 local dx = xpos - obj_xpos
			 local dz = zpos - obj_zpos
			 
			 local dx_view1 = xpos - obj_viewx1
			 local dx_view2 = xpos - obj_viewx2
			 
			 local dz_view1 = zpos - obj_viewz1
			 local dz_view2 = zpos - obj_viewz2
			 
			 gui.drawBox(Xdraw-dx_view1*Zoom, Ydraw-dz_view1*Zoom, Xdraw-dx_view2*Zoom, Ydraw-dz_view2*Zoom, 0xFF000000+i*0x4973+0x36F4)
			 
			 if dx*Zoom <= Xdraw - 320 
			 then 

				  
				  Xcircle = Xdraw-dx*Zoom-obj_radius*Zoom;
				  Ycircle = Ydraw-dz*Zoom-obj_radius*Zoom;
				  Diameter =obj_radius*2*Zoom;
				  
				  gui.drawEllipse(Xcircle, Ycircle, Diameter, Diameter, 0xFF000000+i*0x4973+0x36F4) 	         
				  gui.drawLine(Xdraw, Ydraw, Xdraw-dx*Zoom, Ydraw-dz*Zoom, 0xFF000000+i*0x4973+0x36F4);
				  gui.drawLine(Xdraw-dx*Zoom, Ydraw-dz*Zoom, Xdraw-(dx*Zoom)+math.sin(obj_yrot*math.pi/180)*obj_radius*Zoom, Ydraw-(dz*Zoom)+math.cos(obj_yrot*math.pi/180)*obj_radius*Zoom, 0xFF000000+i*0x4973+0x36F4);
				  gui.drawPixel(Xdraw-dx*Zoom, Ydraw-dz*Zoom, 0xFFFF5500);
				  gui.drawPixel(Xdraw-dx*Zoom+math.sin(obj_yrot*math.pi/180)*obj_radius*Zoom, Ydraw-dz*Zoom+math.cos(obj_yrot*math.pi/180)*obj_radius*Zoom, 0xFFFF5500);
				  
				  
				  
				  if showText
				  then --gui.drawText(Xdraw-dx*Zoom+2, Ydraw-dz*Zoom+2, string.format("%.2f\n%.2f", DistanceToPlayer, EPAngle), 0xFFFFFFFF, 0x00000000);
				  end;
			 else Ys = Ydraw+(320-Xdraw)/-dx*-dz;
				  gui.drawLine(Xdraw, Ydraw, 320, Ys, 0xFF000000+i*0x4973+0x36F4)
			 end;
			 
		end
		
	
	end
	
	
	
	gui.drawBox(320, 229, 330, 239);
	gui.drawText(320, 227, "T");
	
	gui.drawBox(332, 229, 342, 239);
	gui.drawText(332, 227, "-");
	
	gui.drawBox(344, 229, 354, 239);
	gui.drawText(344, 227, "+");
	
	Mouse = input.getmouse();
	
	ML = Mouse.Left
	
	if Mouse.X >= 320 and Mouse.X <= 330 and Mouse.Y >= 229 and Mouse.Y <= 239 and ML
	then if ML_old ~= ML
		 then showText = not showText;
		 end;		
	end;
	
	if Mouse.X >= 332 and Mouse.X <= 342 and Mouse.Y >= 229 and Mouse.Y <= 239 and ML
	then Zoom = Zoom * 0.99;	 		
	end;
	
	if Mouse.X >= 344 and Mouse.X <= 354 and Mouse.Y >= 229 and Mouse.Y <= 239 and ML
	then Zoom = Zoom * 1.01;		
	end;
	
	ML_old = ML;

end

event.onframeend(ObjectView)
while true do
	
	local XZSpeed = memory.readfloat(0x174C68, true);
	local YAngle = memory.readfloat(0x174C64, true);

	local XSpeed = memory.readfloat(0x174C4C, true);
	local YSpeed = memory.readfloat(0x174C50, true);
	local ZSpeed = memory.readfloat(0x174C54, true);

	local XPosition = memory.readfloat(0x174C2C, true);
	local YPosition = memory.readfloat(0x174C30, true);
	local ZPosition = memory.readfloat(0x174C34, true);

	local InAngle = memory.readfloat(0x18148C, true);

	local XZSpeed2 = math.sqrt(XSpeed^2 + ZSpeed^2);

	local XZSA = (math.atan2(XSpeed, ZSpeed)*(180)/math.pi - 90) % 360;

	local XZVector = math.sqrt(XPosition^2 + ZPosition^2)
	
	gui.drawText(0, 15, "XZv':"..XZSpeed2, 0xAAFFFFFF, 0x55000000);
	gui.drawText(0, 30, "XZv :"..XZSpeed, 0xAAFFFFFF, 0x55000000);
	gui.drawText(0, 45, "Ya  :"..YAngle, 0xAAFFFFFF, 0x55000000);
	gui.drawText(0, 60, "XZva:"..XZSA, 0xAAFFFFFF, 0x55000000);
	gui.drawText(0, 75, "Xv:"..XSpeed, 0xAAFFFFFF, 0x55990000);
	gui.drawText(0, 90, "Zv:"..ZSpeed, 0xAAFFFFFF, 0x55009900);   
	gui.drawText(0, 105, "Yv:"..YSpeed, 0xAAFFFFFF, 0x55000099);    
	gui.drawText(0, 125, "Xp:"..XPosition, 0xAAFFFFFF, 0x55990000);
	gui.drawText(0, 140, "Zp:"..ZPosition, 0xAAFFFFFF, 0x55009900);
	gui.drawText(0, 155, "Yp:"..YPosition, 0xAAFFFFFF, 0x55000099);
	gui.drawText(0, 170, "XZ:"..XZVector, 0xAAFFFFFF, 0x55999900);
	-- UxPosition = (math.cos(YAngle*math.pi/180));
	-- UyPosition = (math.sin(YAngle*math.pi/180));
	-- VxPosition = (math.cos((90+YAngle)*math.pi/180));
	-- VyPosition = (math.sin((90+YAngle)*math.pi/180));
	
	
	
	-- gui.drawLine(230, 90, (230+UxPosition*100), (90+UyPosition*100));
	-- gui.drawLine(230, 90, (230+VxPosition*100), (90+VyPosition*100));
	
	-- gui.drawText(0, 160, "Ux:"..UxPosition, 0xAAFFFFFF, 0x55999900)
	-- gui.drawText(0, 175, "Uy:"..UyPosition, 0xAAFFFFFF, 0x55990099)
	--gui.drawText(0, 190, "Vx:"..VxPosition, 0xAAFFFFFF, 0x55999900)
	--gui.drawText(0, 205, "Vy:"..VyPosition, 0xAAFFFFFF, 0x55990099)
	
	--dvx = XPosition + XSpeed;
	--dvy = ZPosition + ZSpeed;
	
	--vx = math.cos(45*math.pi/180) + dvx
	--vy = math.sin(45*math.pi/180) + dvy
	
	--v = math.sqrt(vx^2+vy^2)

	
	
	
	
	--gui.drawText(2, 170, vx.."; "..vy)
	--gui.drawText(2, 191, v);
	
	--gui.drawRectangle(149, 9, 163, 163, 0x00000000, 0x44000000);
	gui.drawLine(150, 90, 310, 90);
	gui.drawPixel(309, 89);
	gui.drawPixel(309, 91);
	gui.drawPixel(151, 89);
	gui.drawPixel(151, 91);
	gui.drawLine(230, 170, 230, 10);
	gui.drawPixel(229, 11);
	gui.drawPixel(231, 11);
	gui.drawPixel(229, 169);
	gui.drawPixel(231, 169);
	
	gui.drawLine(230, 90, 230+XSpeed*3, 90-ZSpeed*3, 0xFFFF0000);
	
	local XCoordYAngl = math.floor(math.cos((YAngle*math.pi)/180)*75);
	local YCoordYAngl = -math.floor(math.sin((YAngle*math.pi)/180)*75);
	
	gui.drawLine(230, 90, 230+XCoordYAngl, 90-YCoordYAngl, 0xFF00FF00);
	
	
	local XCoordInAngl = math.floor(math.cos((InAngle*math.pi)/180)*75);
	local YCoordInAngl = -math.floor(math.sin((InAngle*math.pi)/180)*75);
	
	gui.drawLine(230, 90, 230+XCoordInAngl, 90-YCoordInAngl, 0xFF0000FF);
	
	--ObjectView()
	
	emu.frameadvance();
end