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 


combo box readinteger amd writeinteger commands
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Dec 29, 2013 4:20 am    Post subject: Reply with quote

faizangmc wrote:
mgr.inz.player when i run the script it gives this error :-

Code:
Error:[string "Nationality = "[[[Cricket2013.exe+005D4D20]..."]:47: attempt to call field 'Add' (a nil value)


the script at line 47 is this :-
Code:
-- fill CEComboBox1
MyForm.CEComboBox1.Items.clear()
for _,v in pairs(Nationalities) do
  MyForm.CEComboBox1.Items.Add(v)
end




Hmm. I'm using CE6.3+ (many bugs were fixed) and few useful "forgivable" methods are implemented. Just change it to "add" (from "Add" to "add").

_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sun Dec 29, 2013 4:24 am    Post subject: Reply with quote

6.3+ where did you get that from? I downloaded the the current version on home page.
this one : (from homepage)
Quote:
June 13 2013:Cheat Engine 6.3 Released:
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Dec 29, 2013 4:27 am    Post subject: Reply with quote

You have to compile it yourself (CE source is available on code.google.com), or download "custom builds" from CheatEngine Beta sub-forum.

Just change "Add" to "add". It will be fine.

_________________


Last edited by mgr.inz.Player on Sun Dec 29, 2013 4:29 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sun Dec 29, 2013 4:29 am    Post subject: Reply with quote

Okies! thanks Smile did you read about the dob thing? its not possible right?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Dec 29, 2013 4:53 am    Post subject: Reply with quote

I think you can rewrite that C# code to Lua.




To calculate differences:
- you can convert Gregorian calendar date to Julian Day Number. http://en.wikipedia.org/wiki/Julian_day

JDN1 = converttoJDN(date1)
JDN2 = converttoJDN(date2)
difference = JDN2 - JDN1

- or this: http://www.lua.org/pil/22.1.html
( diffdays = os.difftime(t2, t1) / 86400 )

_________________
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sun Dec 29, 2013 9:16 am    Post subject: This post has 1 review(s) Reply with quote

No problem mate.
Are you asking for translation of the vb code to lua?

Edit:
Just saw your post..
Yes it is possible, but it's gonna be a pain in the ass..
I'll work on it.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sun Dec 29, 2013 9:18 am    Post subject: Reply with quote

Ya from the first look of it I understood its gna be real pain.
Thnx for looking into it. Smile
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sun Dec 29, 2013 9:42 am    Post subject: Reply with quote

Well.
The only hard part is to get difference between those dates.
If anyone wants to give hand, here's my start

Code:
DoB = {
      get = {
            days =    {
                     day =      function (day1, day2)
                                 return (day2-day1);
                              end;
                     week =    function (week1, week2)
                                 return ((week2-week1) * 7);
                              end;
                     month = function (month, year)
                              year = year or os.date('%Y');
                              -- Source http://lua-users.org/wiki/DayOfWeekAndDaysInMonthExample
                              local days_in_month = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
                              local d = days_in_month[month];
                              if (month == 2) then
                                 if (math.mod(year,4) == 0) then
                                    if (math.mod(year,100) == 0)then               
                                       if (math.mod(year,400) == 0) then                   
                                          d = 29;
                                       end
                                    else               
                                       d = 29;
                                    end
                                 end
                              end
                              return d;
                           end;
                     year =    function (year)
                                 local days = 0
                                 for i=1,12 do
                                    local _days = DoB.get.days.month(i, year);
                                    days = days + _days;
                                 end
                                 return days;
                              end;
                        }
            }
      }

Example:
Code:
DoB.get.days.year(2013)

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sun Dec 29, 2013 9:59 am    Post subject: Reply with quote

Ya from the first look of it I understood its gna be real pain.
Thnx for looking into it. Smile
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Dec 29, 2013 5:41 pm    Post subject: Reply with quote

Code:
function returnJDN(year,month,day)
  local a=math.floor((14-month)/12)
  local y=year+4800-a
  local m=month+12*a-3

  return day+math.floor((153*m+2)/5)+365*y+math.floor(y/4)+
         -math.floor(y/100)+math.floor(y/400)-32045
end

function diffDays(date1,date2)
  local jdn1=returnJDN(date1.year, date1.month, date1.day)
  local jdn2=returnJDN(date2.year, date2.month, date2.day)
  return math.abs(jdn1-jdn2)
end

function dateOfBirthToCode(date)
 local epoch1 = {year=1944,month=11,day=8}
 local epoch2 = {year=1989,month=9,day=17}

 local diff = diffDays(epoch1,date)
 local mult=1
 local startZ=208


 if diff>16384 then
  diff = diffDays(epoch2,date)
  mult=2
  startZ=224
 end

 local b0 = (diff%(4*mult))*math.floor(64/mult)
 local b1 = math.floor(diff/(4*mult)) % 256
 local b2 = math.floor(diff/(1024*mult)) + startZ

 return b0,b1,b2
end


date   = {year=1989,month=2,day=22}
print('b0 b1 b2  ')             --debug info
print(dateOfBirthToCode(date))  --debug info
print('')                       --debug info

date   = {year=1989,month=2,day=25}
print('b0 b1 b2  ')             --debug info
print(dateOfBirthToCode(date))  --debug info
print('')                       --debug info

b0,b1,b2 = dateOfBirthToCode(date)



Above script will convert from date to this weird code.

_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sun Dec 29, 2013 11:52 pm    Post subject: Reply with quote

mgr.inz.Player
this is working perfect. The calculation part. This will work for writing the dob. Now what about the reverse thing. 'weird' code to dob? because il need it for reading from players profile.
Also is this possible to incorporate in the edit boxes?
See the editors screenshot on first page. that dob1, dob2, dob3 columns.

'weird' lol. you are using my language. hehe
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Dec 30, 2013 4:30 pm    Post subject: Reply with quote

reverse routine is easy too, there are JDN to date algorithms.


"Also is this possible to incorporate in the edit boxes?
See the editors screenshot on first page. that dob1, dob2, dob3 columns. "
Of course.


Too bad, CE doesn't provide TCalendar object. It would be much better solution. I can build custom CE version for you with Calendar. (current CE revision patched with http://pastebin.com/viKYVQ5h)


TCalendar already provides (indirectly) dateToNumber routine (useful for diff calculations).
So, you don't need "Julian Day Number" anymore.

_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Tue Dec 31, 2013 12:48 am    Post subject: Reply with quote

Unbelievable! you made a new object itself!
Im doing this for the first time. How do install this? I downloaded the .txt file from pastebin. where to place this. and what is the script to add it in my form. I made all my form through form designer not through lua script. so this wud also be a new thing for me.

You should make a new post with calender object and make it stickied. Because its such an important object. The calender. Many people will need it.



final script (latest).CT
 Description:
what change i need to make here?

Download
 Filename:  final script (latest).CT
 Filesize:  169.93 KB
 Downloaded:  978 Time(s)

Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Jan 01, 2014 1:09 pm    Post subject: Reply with quote

faizangmc wrote:
How do install this? I downloaded the .txt file from pastebin

It is not txt file, it is a diff file. You have to save it as TCalendarPatch.diff.

You need:
1. Lazarus downloaded link
2. Lazarus installed like this (if you have 64bit OS) - link

3. You need TortoiseSVN or other SVN client, then you have to download (SVN Checkout) current CheatEngine source files from
Code:
http://cheat-engine.googlecode.com/svn/trunk/Cheat Engine


4. then, TortoiseSVN->Apply patch, and choose TCalendarPatch.diff

5. open cheatengine.lpi file with 32bit Lazarus and compile 32bit CheatEngine
6. open cheatengine.lpi file with 64bit Lazarus and compile 64bit CheatEngine

As I said, I can compile it for you. I already have it.



Download this
http://www.mediafire.com/?in27mxybaf7pkwr
Move it to CheatEngine installation directory (make backup of original file)
launch it, and try this demo code

Code:
UDF1=createForm()
UDF1.Caption='UDF1'
UDF1.show()

calendar = createCalendar(UDF1)
calendar.Top  = 10
calendar.Left = 10

_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Wed Jan 01, 2014 2:40 pm    Post subject: Reply with quote

First of all HAPPY NEW YEAR mgr.inzPlayer
Second, ur patched cheat engine is freaking Aeeweeesome! thankx brother.

How do i readByte and writeByte on this? My script attached

Also, i dont know why the team balance and coach, physio section is showing what this means error in others pc. (people asking me to fix that error on game's forum). But it works perfectly on mine!
They player editing works well for them. Only the right section of the form. (one with balance and coach and physio is showing that error). I tried v much to find where the problem is in the script, but everything seems to be fine. I asked them whether they are going in the right in screen, in the game, they replied yes. if you have time, just scan through the script of the right side of form and see if you find anything wrong. (Not that important though)

But the calender stuff is main, that will add so much to the editor.



final script (latest).CT
 Description:
my script.

Download
 Filename:  final script (latest).CT
 Filesize:  169.9 KB
 Downloaded:  977 Time(s)

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 Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 2 of 9

 
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