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 


How to limit ceedit only numbers and only up to an x value?

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

Joined: 24 Jun 2015
Posts: 31

PostPosted: Wed Sep 13, 2017 8:32 am    Post subject: How to limit ceedit only numbers and only up to an x value? Reply with quote

Hello friends. I'm trying to create a ceedit where I can only enter numbers and it only accepts the maximum value of 100. but I have problems when ceedit is empty with no value of an error. would have a simple way to make ceedit only accept numbers and that if you type above a value it erases a house and the message how am I doing? Thanks for the help. I did not find topics about this so I ask. What I did works more or less.

Code:
function CEEdit1Change(sender)
CheckForNumbers()
a=control_getCaption(UDF1_CEEdit1)
b=(tonumber(a))
if b > 100 then
messageDialog("max 100",4,2);
end
end



Capturar.PNG
 Description:
 Filesize:  60.1 KB
 Viewed:  1294 Time(s)

Capturar.PNG


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 342

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

PostPosted: Wed Sep 13, 2017 9:03 am    Post subject: Reply with quote

Code:

function CEEdit1Change(sender)
  local s=sender.Text
  if s=='' then return end

  local b=tonumber(sender.Text) --returns nil if not a number
  if b~=nil then
    if b>100 then
      messageDialog('max 100', mtWarning, mbOK)
    end
  else
    messageDialog('Invalid value', mtError, mbOK)
  end
end

_________________
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
hemersonkla1
Cheater
Reputation: 0

Joined: 24 Jun 2015
Posts: 31

PostPosted: Wed Sep 13, 2017 9:22 am    Post subject: Reply with quote

Dark Byte wrote:
Code:

function CEEdit1Change(sender)
  local s=sender.Text
  if s=='' then return end

  local b=tonumber(sender.Text) --returns nil if not a number
  if b~=nil then
    if b>100 then
      messageDialog('max 100', mtWarning, mbOK)
    end
  else
    messageDialog('Invalid value', mtError, mbOK)
  end
end



Thank you so much. Dark Byte. Another question how can I make a backspace in a house?
In case if the person type 1000 give the message but delete a house and return to 100 or if the person enters 999 delete a house and return to 99. Thank you very much.



Capturar.PNG
 Description:
 Filesize:  58.95 KB
 Viewed:  1284 Time(s)

Capturar.PNG


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 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