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 


Need Help-Script Multilang
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Tue Jan 12, 2016 5:30 am    Post subject: Need Help-Script Multilang Reply with quote

hi,i need to add a second language(Italian)inside of Lua Script..when i select the language,to change to udf2..

I would be really grateful if you could answer or give me a little help!


Last edited by samtrainers87 on Tue Jan 12, 2016 7:11 pm; edited 2 times in total
Back to top
View user's profile Send private message Yahoo Messenger
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue Jan 12, 2016 11:18 am    Post subject: Reply with quote

If it's two entirely separate forms:
Code:
function CEComboBox2Change(sender)
  if sender.ItemIndex == 0 then
    form1.show()
    form2.hide()
  elseif sender.ItemIndex == 1 then
    form1.hide()
    form2.show()
  end
end

If you don't have two entirely separate forms and you're just changing the text:
Code:
function CEComboBox2Change(sender)
  if sender.ItemIndex == 0 then
    --change all text to English
    --example:
    UDF1.CELabel1.Caption = "English"
  elseif sender.ItemIndex == 1 then
    --change all text to Italian
    --example:
    UDF1.CELabel1.Caption = "Italiano"
  end
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Tue Jan 12, 2016 1:27 pm    Post subject: Need Help-Script Multilang Reply with quote

I tried but it always comes out error..Please, you can enter the code into the trainer.ct I have posted?I have a big need of your help
Back to top
View user's profile Send private message Yahoo Messenger
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue Jan 12, 2016 1:44 pm    Post subject: Reply with quote

It's not going to work if you just copy and paste it in. The variable names are probably going to be different, and you need to assign that function to the OnChange property of CEComboBox2. Could you give more information such as what error you're getting, where it is, and what you're writing?

Also I can't really test it myself since it crashes every time I execute the script w/ CE 6.5. So take a look at that. Also, please properly indent your code. It takes little effort to do as you're writing code and it helps out everyone who looks at it (including you).

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Tue Jan 12, 2016 2:31 pm    Post subject: Reply with quote

Its this part that closes the trainer. I just nulled it out.

Code:

function blockhack()
---cheateninge--
function closecengine()
if openProcess("cheatengine") then
closeCE()
end
end
t=createTimer(nil)
timer_onTimer(t, closecengine)
timer_setInterval(t, 200)
timer_setEnabled(t, true);


So my question is what needs to be translated? I like @ParkourPenguin idea of just changing text with a toggle and not making a new form. But i don't see much on there that is text. Do you mean just the info button (popup message window)?

Quick Edit:

So for examle. I added a toggle switch where your pull down menu was (removed the pulldown). Then i did
Code:

asd = 1
function CEToggleBox1Change(sender)
  if (checkbox_getState(CETrainer.CEToggleBox1) == 0) then
control_setCaption(CETrainer.CEToggleBox1, "English")
asd = 1
  elseif (checkbox_getState(CETrainer.CEToggleBox1) == 1) then
control_setCaption(CETrainer.CEToggleBox1, "Italian")
asd = 2
  end
end


So now asd is declared with a value depending on what state the toggle is in. So now we would edit the info button

Code:

function CEButton2Click(sender)
if (asd == 1) then
showMessage("Pudding Pop Vers.3\nRelease Date: 11/01/2016\nAuthor: Tugneanu Samuel\n\n- For Update Trainers: https://www.facebook.com/tugneanu.samuel/\n\n-IMPORTANT :\nDo not open Cheat Engine or Charles\nwhen you're using my Trainers.")
elseif (asd == 2) then
showMessage('Not English')
end
end


so now the trainer knows what state the toggle is in it will use that to determine what popup message to show.
Back to top
View user's profile Send private message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Tue Jan 12, 2016 2:39 pm    Post subject: Need Help-Script Multilang Reply with quote

i need to translate--info button,select a processor,and the name of hacks..but i dont know how to do that
if you want to help me,add the codes into ct..
Back to top
View user's profile Send private message Yahoo Messenger
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue Jan 12, 2016 2:55 pm    Post subject: Reply with quote

http://translate.google.com

If you mean you don't know how to do that using Lua, then read Fluffer_Nutter's post. Having a variable to determine what to print (or just directly reading from CEComboBox2.ItemIndex) is a good idea for displaying text. You'll still need to set the text on buttons and other GUI items manually in the OnChange function of the combo box. For more generic help on working with Lua, go through this and/or look up a Lua tutorial.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Tue Jan 12, 2016 5:44 pm    Post subject: Need Help-Script Multilang Reply with quote

after hours and hours I managed to finish the trainer..
I would like to thank all of you for the hints!
Back to top
View user's profile Send private message Yahoo Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Jan 12, 2016 10:27 pm    Post subject: Reply with quote

Code:
localization = {
  ["English"] = {
    readBeforeUse = "Read Before Use",
    attach = "Attach",
  },
  ["Italiano"] = {
    readBeforeUse = "Leggere Prima Dell'uso",
    attach = "Allegare",
  }
}

locale = localization["English"]

function updateLocale()
  UDF1.CEButton1.Caption = locale.readBeforeUse
  UDF1.CEButton2.Caption = locale.attach
end

function CEComboBox1Change(sender)
  locale = localization[sender.Text]
  updateLocale()
end
Back to top
View user's profile Send private message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Wed Jan 13, 2016 8:37 am    Post subject: Need Help-Script Multilang Reply with quote

thank you zanzer..I managed to create the trainer with 3 UDF,everything works fine,but when i select the language for example

English is set to itemindex 0
Italian is set to itemindex 1 in this order WORK FINE
German is set to itemindex 2


but,when i try to return from German to English(or Italian),the UDF change to English,but the language displayed on selection is still German..
I missing something..


how to show the messagge inside the readBeforeUse?
with this function:

function updateLocale()



ph5.png
 Description:
 Filesize:  108.07 KB
 Viewed:  12168 Time(s)

ph5.png



ph4.png
 Description:
 Filesize:  110.13 KB
 Viewed:  12168 Time(s)

ph4.png



ph3.png
 Description:
 Filesize:  24.18 KB
 Viewed:  12168 Time(s)

ph3.png



ph2.png
 Description:
 Filesize:  37.21 KB
 Viewed:  12168 Time(s)

ph2.png



ph1.png
 Description:
 Filesize:  16.37 KB
 Viewed:  12168 Time(s)

ph1.png


Back to top
View user's profile Send private message Yahoo Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Jan 13, 2016 8:32 pm    Post subject: Reply with quote

Well, my code would only require a single form.
You are simply updating the caption text of the buttons and labels based on the localization.

Your problem is that you are using different forms, and therefore, different dropdowns.
So the first time you select German, from the English form, it hides the English form and opens German.
However, if you now go back to the English form, the dropdown is going to still show what you last selected on that form (German).
To fix this, you will need to update your ComboBoxChange function to also set the dropdown back to its form's value.
I would probably add the text "Select your language" as the first option and then simply use:
Code:
sender.ItemIndex = 0

To always selected it after the Change event. Simply have your logic ignore when ItemIndex == 0.
Back to top
View user's profile Send private message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Thu Jan 14, 2016 4:01 am    Post subject: Need Help-Script Multilang Reply with quote

i created another trainer with one form..i used your example,i added CECheckbox1Click sender but the hacks do not appear to activate..

Here is the code i used for all 6 CECheckbox1Click
what is wrong?

Code:
function CEComboBox2Change(sender)
  locale = localization[sender.Text]
  updateLocale()
end
if openProcess(CETrainer.CEComboBox1.Text) then
end
function CECheckbox1Click(sender)
  addresslist=getAddressList()
  if sender.state == 1 then
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Freeze Coins Boosters]])
    memoryrecord_freeze(CheatEntry)
    showMessage("Enabled")
  else
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Freeze Coins Boosters]])
    memoryrecord_unfreeze(CheatEntry)
    showMessage("Disabled")
  end
end
function CECheckbox2Click(sender)
  addresslist=getAddressList()
  if sender.state == 2 then
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Buy Boosters]])
    memoryrecord_freeze(CheatEntry)
    showMessage("Enabled")
  else
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Buy Boosters]])
    memoryrecord_unfreeze(CheatEntry)
    showMessage("Disabled")
  end
end
function CECheckbox3Click(sender)
  addresslist=getAddressList()
  if sender.state == 3 then
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Real Score]])
    memoryrecord_freeze(CheatEntry)
    showMessage("Enabled")
  else
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Real Score]])
    memoryrecord_unfreeze(CheatEntry)
    showMessage("Disabled")
  end
end
function CECheckbox4Click(sender)
  addresslist=getAddressList()
  if sender.state == 4 then
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Visual Score]])
    memoryrecord_freeze(CheatEntry)
    showMessage("Enabled")
  else
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Visual Score]])
    memoryrecord_unfreeze(CheatEntry)
    showMessage("Disabled")
  end
end
function CECheckbox5Click(sender)
  addresslist=getAddressList()
  if sender.state == 5 then
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Add moves]])
    memoryrecord_freeze(CheatEntry)
    showMessage("Enabled")
  else
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Add moves]])
    memoryrecord_unfreeze(CheatEntry)
    showMessage("Disabled")
  end
end
function CECheckbox6Click(sender)
  addresslist=getAddressList()
  if sender.state == 6 then
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Instant Win]])
    memoryrecord_freeze(CheatEntry)
    showMessage("Enabled")
  else
    CheatEntry=addresslist_getMemoryRecordByDescription(addresslist,[[Instant Win]])
    memoryrecord_unfreeze(CheatEntry)
    showMessage("Disabled")
  end
end



udf 1.png
 Description:
 Filesize:  17.31 KB
 Viewed:  12081 Time(s)

udf 1.png


Back to top
View user's profile Send private message Yahoo Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Jan 14, 2016 9:04 am    Post subject: Reply with quote

Not receiving any errors or anything? Are you receiving your "Enabled" message?
Did you remember to actually assign the function to each checkbox's click event?
Back to top
View user's profile Send private message
samtrainers87
Newbie cheater
Reputation: 0

Joined: 11 Jan 2016
Posts: 11
Location: Germany

PostPosted: Fri Jan 15, 2016 11:33 am    Post subject: Need Help-Script Multilang Reply with quote

not receive any error,only appears checked but not active the hacks..i assigned all the function to each checkbox's
Now I am forced to use two buttons,Enable-Disable even if I like more Checkbox..



3.png
 Description:
 Filesize:  109.93 KB
 Viewed:  11998 Time(s)

3.png



2.png
 Description:
 Filesize:  8.38 KB
 Viewed:  11998 Time(s)

2.png



1.png
 Description:
 Filesize:  39.2 KB
 Viewed:  11998 Time(s)

1.png


Back to top
View user's profile Send private message Yahoo Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Jan 15, 2016 4:26 pm    Post subject: Reply with quote

If you're not receiving any message, specifically your showMessage("Enabled"), then it sounds like you didn't set the event properly.
Are you sure you're dealing with the correct form and the correct checkbox?
Have you executed the Lua within the table to initialize all of those functions?
There must be some indication! Care to post your CE table?
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 Lua Scripting All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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