Jump to content

Need help making a script to edit each value


TisNquyen
 Share

Recommended Posts

I have tried many times but can not find the value, if found also can not edit, so I need help from you

 

 

 

 gg.setVisible(false)
gg.searchNumber('0.8;1.9;3.25', gg.TYPE_FLOAT)
local results = gg.getResults(100) 

for i, v in ipairs(results) do
         if v.value == '0.8' then
             v.value = '1.49'
  elseif v.value == '1.9' then
             v.value = '2.4'
  elseif v.value == '3.25' then
             v.value = '3.59' end
end

gg.setValues(results)


while true do 
  if gg.isVisible() then
      break
    else
      gg.sleep(100);
    end
end

os.exit()

Edited by TisNquyen
Misspell
Link to comment
Share on other sites

8 hours ago, Enyby said:

Dword can not be fractional.

I'm sorry for the wrong writing, but I still need your help

gg.searchNumber('0.8;1.9;3.25',gg.TYPE_FLOAT)

Link to comment
Share on other sites

  • Administrators
1 hour ago, TisNquyen said:

I still need your help

I do not see what.

12 hours ago, TisNquyen said:

if v.value == '0.8' then

You need read about float and it precision. Possible this compare not work. Try use number, not string.

Also maybe it not work too. In general compare for equal fractional values is bad idea.

It is known issue with fractional values. So you can use Internet for search solution. For example: http://lua.2524044.n2.nabble.com/Float-numbers-equality-td7651382.html

Link to comment
Share on other sites

5 giờ trước, Enyby nói:

I did not found.

You need to read about phao and precision. This comparison is not work. Try to use number, not a string.

Cũng có thể nó cũng không hoạt động. Nói chung so sánh các giá trị phân số bằng nhau là ý tưởng tồi.

Nó được biết đến vấn đề với các giá trị phân đoạn. Vì vậy, bạn có thể sử dụng Internet cho giải pháp tìm kiếm. Ví dụ: http://lua.2524044.n2.nabble.com/Float-numbers-equality-td7651382.html

I still do not understand!

Can you guide me in detail?

Link to comment
Share on other sites

  • Administrators

@TisNquyen I can not go the way for you. You must go through it yourself.
In short, fractional numbers should be compared approximately like this:

if math.abs(x - 3.4) < 0.00001 then -- here compare x with 3.4
  -- do something if x equal 3.4
end

 

Link to comment
Share on other sites

17 minutes ago, Enyby said:

@TisNquyen I can not go the way for you. You must go through it yourself.
In short, fractional numbers should be compared approximately like this:


if math.abs(x - 3.4) < 0.00001 then -- here compare x with 3.4
  -- do something if x equal 3.4
end

 

Thank you! You do not understand this, I do not understand. Because I do not understand high education. So do not understand, whether you reply to me

Thank you!

Link to comment
Share on other sites

39 minutes ago, Enyby said:

@TisNquyen Tôi đã viết tất cả các bạn ở trên. Ngay cả liên kết đã cho. Đừng quá bất lực - hãy thử tìm kiếm thông tin trên Internet. Điều này được thực hiện rất đơn giản.

Without the script template, nothing is simple

Link to comment
Share on other sites

Cách đây 14 phút, Enyby đã nói:

@TisNquyen Điều này không đúng. Tìm hiểu lua. Tìm hiểu cách sử dụng tìm kiếm trên Internet và bạn sẽ không cần mẫu.

Sorry! I'm a beginner in scripting so I do not understand much and have tried many ways, but many places do not have a place to guide.

Since and I recently posted this article to ask if anyone was guiding me, but still have not found a good answer, I am very disappointed!

Link to comment
Share on other sites

  • Administrators

@TisNquyen This is not a school, or a kindergarten. This is the Internet. No one will nurse you. You must train yourself. There is enough information on the Internet for this. It's silly to expect that someone will teach you on the Internet.
If you are not able to learn by yourself - hire a tutor who will teach you and to whom you will pay money.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.