Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[REQUEST] d3d menu lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
pakeke801
Cheater
Reputation: 0

Joined: 19 Apr 2012
Posts: 27

PostPosted: Sun Apr 29, 2012 2:22 am    Post subject: [REQUEST] d3d menu lua Reply with quote

hi sir, im just newbie about LUA scripting...
can you post a d3d lua menu??????
sorry bout my question...
its hard for very begginer.......
btw, i think its more easy to
have a d3d menu with dll
than LUA?????

_________________
this is the end!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 338

Joined: 09 May 2003
Posts: 19742
Location: The netherlands

PostPosted: Sun Apr 29, 2012 8:02 am    Post subject: Reply with quote

Looks like there are a few bugs with click handling of textcontainers so you'll have to wait till next build

anyhow, this should create a blue rectangle with 3 options.
Code:

--create a background image (in this case, just a simple 1 pixel color stretched)
background=createPicture()
bmp=picture_getBitmap(background);

graphic_setHeight(bmp,1)
graphic_setWidth(bmp,1)
c=rasterImage_getCanvas(bmp)

canvas_setPixel(c,0,0,0xff0000)


d3dhook_initializeHook()
bgtexture=d3dhook_createTexture(background);

bgsprite=d3dhook_createSprite(bgtexture);
d3dhook_sprite_setWidth(bgsprite,200)
d3dhook_sprite_setHeight(bgsprite,200)


font=control_getFont(getMainForm())  --note to self: Add a createFont function (for now, create a hidden form with components that have the fonts you need)
fontmap=d3dhook_createFontmap(font)

--normally I would have used this:
--lineheight=d3dhook_texture_getHeight(fontmap) --fontmap inherits from texture so this can be used
--But due to a bug this isn't working yet
--so:
lineheight=25

Option1=d3dhook_createTextContainer(fontmap,10,50,'Click for option 1: OFF')
Option2=d3dhook_createTextContainer(fontmap,10,50+lineheight,'Click for option 2: OFF')
Option3=d3dhook_createTextContainer(fontmap,10,50+lineheight*2,'Click for option 3: OFF')

function objectclick(object, x, y)
  bla=userDataToInteger(object)
  print(string.format("click on %x",bla))


  if (object==Option1) then
    print("handle option 1")
  end

  if (object==Option2) then
    print("handle option 2")
  end

  if (object==Option3) then
    print("handle option 3")
  end


end
d3dhook_onClick(objectclick)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
pakeke801
Cheater
Reputation: 0

Joined: 19 Apr 2012
Posts: 27

PostPosted: Sun Apr 29, 2012 7:34 pm    Post subject: Reply with quote

sir just a question????, how to execute that lua and inject it??????
_________________
this is the end!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 338

Joined: 09 May 2003
Posts: 19742
Location: The netherlands

PostPosted: Mon Apr 30, 2012 7:02 pm    Post subject: Reply with quote

Go to the lua engine in memoryview and paste it in.

Also, here is an update script for a menu. (option selection and keyboard navigation)
Get the rc2 in the beta section

Code:

--create a background image (in this case, just a simple 1 pixel color stretched)
background=createPicture()
bmp=picture_getBitmap(background);

graphic_setHeight(bmp,1)
graphic_setWidth(bmp,1)
c=rasterimage_getCanvas(bmp)

canvas_setPixel(c,0,0,0xff0000)

highlighter=createPicture()
bmp=picture_getBitmap(highlighter);

graphic_setHeight(bmp,1)
graphic_setWidth(bmp,1)
c=rasterimage_getCanvas(bmp)

canvas_setPixel(c,0,0,0x0000ff)



d3dhook_initializeHook()
bgtexture=d3dhook_createTexture(background)

bgsprite=d3dhook_createSprite(bgtexture);
d3dhook_renderobject_setX(bgsprite, -1) --center it horizontally
d3dhook_sprite_setWidth(bgsprite,200)
d3dhook_sprite_setHeight(bgsprite,200)

highlightertexture=d3dhook_createTexture(highlighter)
hlsprite=d3dhook_createSprite(highlightertexture)
d3dhook_renderobject_setVisible(hlsprite, false) --don't show it just yet
d3dhook_renderobject_setX(hlsprite, -1) --center (so matches with the background)
d3dhook_sprite_setWidth(hlsprite,200)



font=createFont()
fontmap=d3dhook_createFontmap(font)

lineheight=d3dhook_texture_getHeight(fontmap) --fontmap inherits from texture so this can be used

d3dhook_sprite_setHeight(hlsprite,lineheight) --make the highlightr the same height as a textline

Option1=d3dhook_createTextContainer(fontmap,-1,50,'Option 1: OFF')
Option2=d3dhook_createTextContainer(fontmap,-1,50+lineheight,'Option 2: OFF')
Option3=d3dhook_createTextContainer(fontmap,-1,50+lineheight*2,'Option 3: OFF')
Option1State=false
Option2State=false
Option3State=false


selectedOption=1

function setHighlighterToSelectedOption()
  d3dhook_renderobject_setY(hlsprite, 50+lineheight*(selectedOption-1)) 
end


setHighlighterToSelectedOption()
d3dhook_renderobject_setVisible(hlsprite, true)

function ExecuteSelectedOption()
  local onoff="OFF";

  if (selectedOption==1) then
    Option1State=not Option1State
    if (Option1State) then
      onoff="ON"
    else
      onoff="OFF"
    end   
    d3dhook_textcontainer_setText(Option1,'Option 1: '..onoff);
  end

  if (selectedOption==2) then
    Option2State=not Option2State
    if (Option2State) then
      onoff="ON"
    else
      onoff="OFF"
    end
    d3dhook_textcontainer_setText(Option2,'Option 2: '..onoff);
  end

  if (selectedOption==3) then
    Option3State=not Option3State
    if (Option3State) then
      onoff="ON"
    else
      onoff="OFF"
    end
    d3dhook_textcontainer_setText(Option3,'Option 3: '..onoff);
  end

 
end

function objectclick(object, x, y)
  --bla=userDataToInteger(object)
  --print(string.format("click on %x",bla))


  if (object==Option1) then
    selectedOption=1
    ExecuteSelectedOption()
  end

  if (object==Option2) then
    selectedOption=2
    ExecuteSelectedOption()
  end

  if (object==Option3) then
    selectedOption=3
    ExecuteSelectedOption()
  end

  setHighlighterToSelectedOption()
end
d3dhook_onClick(objectclick)

function keydown(virtualkey,char)
  if (virtualkey==VK_DOWN) then
    --down arrow
    if (selectedOption<3) then
      selectedOption=selectedOption+1
    end
  end

  if (virtualkey==VK_UP) then
    --up arrow
    if (selectedOption>1) then
      selectedOption=selectedOption-1
    end
  end

  if (virtualkey==VK_RETURN) then
    ExecuteSelectedOption()
  end

  setHighlighterToSelectedOption()

  return true
end

d3dhook_onKey(keydown)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
pakeke801
Cheater
Reputation: 0

Joined: 19 Apr 2012
Posts: 27

PostPosted: Tue May 01, 2012 5:49 am    Post subject: Reply with quote

tnx so much sir
_________________
this is the end!
Back to top
View user's profile Send private message
ZxPwds
Newbie cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 20

PostPosted: Sun Nov 01, 2015 9:45 pm    Post subject: Reply with quote

After I execute the script it works. But is there a way to hide and unhide the menu using a hotkey? and also when I minimize from the game when it's hooked all I get is a BLUE screen then I gotta exit the game and reopen it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites