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 


Animation not work in CE 6.5

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri Jan 08, 2016 7:54 pm    Post subject: Animation not work in CE 6.5 Reply with quote

This is a CETrainer by mgr.inz.Player :

http://forum.cheatengine.org/viewtopic.php?t=562691

The animating background not work in CE 6.5.
Is it cause by alpha blend setting or other ?

Rgds



starsAnimation__.cetrainer
 Description:

Download
 Filename:  starsAnimation__.cetrainer
 Filesize:  423.79 KB
 Downloaded:  222 Time(s)

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

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

PostPosted: Sat Jan 09, 2016 2:17 pm    Post subject: Reply with quote

This is because Dark Byte switched from Lua 5.1 to 5.3.

In Lua5.1, function lua_tointeger truncates floating-point values ( like 10.3 ==> 10)

From what I see in lua5.1-32.dll, there is cvttsd2si ("Convert Scalar Double-Precision Floating-Point Value to Signed Doubleword Integer with Truncation")


In Lua5.3, function lua_tointeger works differently. (like 10.3 ==> 0). So, my script has to be updated. Bunch of math.floor functions. But, it might add some extra overhead...



Hmm, maybe it would be better to add such function to LuaHandler.pas:
Code:
function lua_tointeger_alt(L: Plua_State; idx: Integer): lua_Integer; cdecl;
var
  isnum: Integer;
begin
  result:=lua_tointegerx(L,idx,@isnum);
  if isnum=0 then
  begin
    result:=trunc(lua_tonumberx(L,idx,@isnum));
    if isnum=0 then raise exception.create('Not valid integer');
  end;
end;



And use it in all places where are high chances that user will use calculated values.

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

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Jan 09, 2016 7:49 pm    Post subject: Reply with quote

Thank mgr.inz.Player

So it's better to re-read for some Lua 5.1 function and adapting it all to Lua 5.3 or doing a debugging. Because some of my trainers made by Lua 5.1 also not running in CE 6.5 (Lua 5.3).

Thank again for solution and information.

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

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

PostPosted: Sat Jan 09, 2016 8:16 pm    Post subject: Reply with quote

Some can be easily fixed. Below cetrainer file has those math.floor in some places.

But, I think DB could do some changes in lua.pas to make CE6.5 more backward compatible.

For example, I tried below function and compiled CE myself:
Code:
function lua_tointeger(L: Plua_State; idx: Integer): lua_Integer; cdecl;
var
  isnum: Integer;
begin
  result:=lua_tointegerx(L,idx,@isnum);
  if isnum=0 then
  begin
    result:=trunc(lua_tonumberx(L,idx,@isnum));
    if isnum=0 then result:=0;
  end;
end;


starsAnimation and NFOWindow (my old Lua scripts) now work normally.


I already mentioned about this in "CE 6.5 bugs" thread.



starsAnimation.cetrainer
 Description:

Download
 Filename:  starsAnimation.cetrainer
 Filesize:  378.92 KB
 Downloaded:  277 Time(s)


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

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Jan 10, 2016 8:09 pm    Post subject: Reply with quote

Many thanks, Now I can learn where is different in script coding by comparing your two CT files.

This is very helpful for me to learn more.

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

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

PostPosted: Mon Jan 11, 2016 8:36 am    Post subject: Reply with quote

Re-download CE6.5 from main page and reinstall.
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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