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 


DirectX Message in game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Tue Oct 09, 2012 10:50 am    Post subject: DirectX Message in game This post has 1 review(s) Reply with quote

This Lua code show message in center game-window 2 seconds.

Use hot-key CTRL+1.
Change "processName = '[Game.exe]' "


Create *.CETRAINER
Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="14">
    <LuaScript>processName = 'Game.exe'

isD3dhook_initializeHook = false
isTimerShowingMessageInGameMenu = false

function OnCloseClick(sender)
    closeCE()
    return caFree
end

trainerForm = createForm()
form_onClose(trainerForm, OnCloseClick)
control_setCaption(trainerForm, 'Trainer Form v1.0 (in game message)')
form_centerScreen(trainerForm)

exitBtn = createButton(trainerForm)
control_setCaption(exitBtn, 'Exit')
control_onClick(exitBtn, OnCloseClick)
control_setSize(exitBtn, 200, 70)
control_setPosition(exitBtn, 62, 130)

labelCaption1 = createLabel(trainerForm)
control_setCaption(labelCaption1, 'Press in game: CTRL + 1')
control_setPosition(labelCaption1, 62, 30)
form_show(trainerForm)


autoAttachList = getAutoAttachList()
stringlist_add(autoAttachList, processName);

function onOpenProcess(processid)
    if not isD3dhook_initializeHook then
        reinitializeSymbolhandler()
        d3dhook_initializeHook()
        isD3dhook_initializeHook = true
        ShowMessageInGame('d3dhook initialize Hook!', 400, 100, 2)
      createHotkey(OnKeyPressSomeActivate, VK_CONTROL, VK_1)
    end
end


function OnTickTimerShowingMessageInGameMenu(senderTimer)
    timer_setEnabled(senderTimer, false)
    object_destroy(senderTimer)
    object_destroy(displayedTextObject)
    object_destroy(fontmap)
    object_destroy(font)
    isTimerShowingMessageInGameMenu = false
end


function ShowMessageInGame(stringMessage, fontWidthTextContainer, fontHeightTextContainer, timeShowing)
    font = createFont()
    font_setSize(font, 24)
    font_setColor(font,0x0000ff) --red rgb

    fontmap = d3dhook_createFontmap(font)

    displayedTextObject = d3dhook_createTextContainer(fontmap, fontWidthTextContainer, fontHeightTextContainer, stringMessage )

    d3dhook_renderobject_setY(displayedTextObject, -1)
    d3dhook_renderobject_setX(displayedTextObject, -1)

    messageTimer = createTimer(nil, false)
    timer_setInterval(messageTimer, timeShowing * 1000)
    timer_onTimer(messageTimer, OnTickTimerShowingMessageInGameMenu)
    timer_setEnabled(messageTimer, true)
    isTimerShowingMessageInGameMenu = true
end


pressCount = 0
function OnKeyPressSomeActivate()
    if not isTimerShowingMessageInGameMenu then
        pressCount = pressCount + 1
        ShowMessageInGame('Message count №'..pressCount..' !', 400, 100, 2)
    end
end
    </LuaScript>
</CheatTable>
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 Tutorials -> LUA Tutorials 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 cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites