Jump to content

Question

Posted

I need a code that will minimize it when you click on the cancel button in the script. I have such a code and in fact it works fine, but when you go many times between the various menu sections of which I have a lot in the script, after pressing the cancel button, it’s completely tough, functions that in principle cannot be called from one menu begin to be called to another, so he noticed that after a long transition between menus, the cancel button starts working every other time, that is, I press cancel and the menu starts again and only the second time the menu is hidden. Here is my code please optimize it for me

 

 

while true do
  if gg.isVisible(true) then
    HOMEDM = 1
    gg.setVisible(false)
  end
  if HOMEDM == 1 then
    Test()
  end
end

14 answers to this question

Recommended Posts

  • 0
Posted
23 minutes ago, MonkeySAN said:

this..?

while true do
  if gg.isVisible(true) then
    HOMEDM = 1
  end
  if HOMEDM == 1 then
    gg.setVisible(false)
    Test()
  end
end

 

why did you send me the same code that I asked to optimize

  • 0
Posted

i don't understand what you mean, i tried with a piece of code like this, and when i click cancel the menu is always hidden, no matter what menu!

X = {"A","B"}

function A()
	menu = gg.choice(X,nil,"Menu A")
	if menu == 1 then B() end
	if menu == 1 then B() end
	Homedm = -1
end

function B()
	menu = gg.choice(X,nil,"Menu B")
	if menu == 1 then C() end
	if menu == 1 then C() end
	Homedm = -1
end

function C()
	menu = gg.choice(X,nil,"Menu C")
	if menu == 1 then A() end
	if menu == 1 then A() end
	Homedm = -1
end

while true do 
	if gg.isVisible(true) then
    	Homedm = 1
    	gg.setVisible(false)
	end
	if Homedm == 1 then
		A()
	end
end

 

  • 0
Posted

so weird i didnt notice it before..

what does the "Homedm = -1" do in a function really?

what its relation with this below?

while true do 
	if gg.isVisible(true) then
    	Homedm = 1
    	gg.setVisible(false)
	end
	if Homedm == 1 then
		A()
	end

hope someone more expert can give some insight on this.

@CmP maybe?

  • 0
Posted
5 hours ago, hoangninyb said:

i don't understand what you mean,

We dont understand what you mean too. it will be great if you explains more clear.

This is what i think you need. may be wrong

ok.lua

 

  • 0
Posted (edited)
31 minutes ago, Lover1500 said:

We dont understand what you mean too. it will be great if you explains more clear.

This is what i think you need. may be wrong

ok.lua 945 B · 0 downloads

 

hmm..🤔

base on your script...thats probably whats he want.(maybe)

press cancel will hide the script menu but press GG logo again will bring back the menu that you had left before..not the very first menu(main).

he did mention his script had various menu by a lot and so on..so on(parts i dont have clear understand)

Edited by MonkeySAN
  • 0
Posted
5 hours ago, MonkeySAN said:

what does the "Homedm = -1" do in a function really?

It seems to be some kind of global state variable to control whether main menu should be opened immediately after execution returns to main loop. But more often than not such behavior isn't needed and when it is so, the variable becomes redundant and can be removed. Main loop can be then replaced with the following typical one: 

while true do
  if gg.isVisible()
    gg.setVisible(false)
    Test()
  end
  gg.sleep(100)
end
  • 0
Posted
2 hours ago, Lover1500 said:

We dont understand what you mean too. it will be great if you explains more clear.

This is what i think you need. may be wrong

ok.lua 945 B · 4 downloads

 

Well, it's not clear, let's take your code, for example, if there are not 3 menus, but for example 30, then this function that hides the script simply will not work, that simply will not work and that's it. I already solved this problem by dropping the code to hide GG under the function.

2 hours ago, Lover1500 said:

Мы тоже не понимаем, что вы имеете в виду. будет здорово, если вы объясните более ясно.

Я думаю, это то, что вам нужно. может ошибаться

ok.lua 945 млрд · 3 загрузки

 

why it would seem that the skins should be executed correctly, but for some reason there are bugs or something else, and the script simply does not see these lines from below that are responsible for hiding gg.

1 hour ago, MonkeySAN said:

Хм..🤔

основываясь на вашем сценарии ... вероятно, это то, что он хочет. (возможно)

нажмите «Отмена», чтобы скрыть меню сценария, но нажмите логотип GG еще раз, чтобы вернуться в меню, которое вы покинули ранее ... не в самое первое меню (главное).

он упомянул, что в его сценарии было много разных меню и так далее ... и так далее (части, которые я не могу четко понять)

I mean what I want, I am very good at writing scripts, well, that is, I am very good at it, but such bugs are just like gg doesn’t read the script correctly.

  • 0
Posted
6 minutes ago, zolotov123344 said:

Ну непонятно, возьмем ваш код, например, если меню не 3, а например 30, то эта функция, скрывающая скрипт, просто не сработает, просто не сработает и все. Я уже решил эту проблему, сбросив код, скрывающий GG под функцией.

почему могло бы показаться, что скины должны выполняться правильно, но по каким-то причинам есть баги или еще что-то, и скрипт просто не видит эти строки снизу, отвечающие за скрытие gg .

Я имею в виду то, что хочу, я очень хорошо пишу скрипты, ну то есть я очень хорошо это делаю, но такие ошибки такие же, как gg не читает скрипт правильно.

google translate translates my text disgustingly

  • 0
Posted (edited)
2 hours ago, zolotov123344 said:

google translate translates my text disgustingly

yup..Google Translate can be such an idiot sometime.

im still had no idea what are you try to tell us..plus my english wasnt that good either.

but is your problem solved now?

Edited by MonkeySAN
  • 0
Posted
On 11/27/2021 at 1:32 AM, zolotov123344 said:

I need a code that will minimize it when you click on the cancel button in the script. I have such a code and in fact it works fine, but when you go many times between the various menu sections of which I have a lot in the script, after pressing the cancel button, it’s completely tough, functions that in principle cannot be called from one menu begin to be called to another, so he noticed that after a long transition between menus, the cancel button starts working every other time, that is, I press cancel and the menu starts again and only the second time the menu is hidden. Here is my code please optimize it for me

 

 

while true do
  if gg.isVisible(true) then
    HOMEDM = 1
    gg.setVisible(false)
  end
  if HOMEDM == 1 then
    Test()
  end
end

Use return.

  • 0
Posted
10 hours ago, MonkeySAN said:

ага .. Google Translate может быть таким идиотом когда-нибудь.

Я все еще понятия не имел, что ты пытаешься нам сказать ... плюс мой английский тоже был не так хорош.

но теперь твоя проблема решена?

yes

  • 0
Posted

I think I understand what you saying

function HOME()
while true do
  if gg.isVisible(true) then
    sys = 1
    gg.setVisible(false)
  end
  if sys == 1 then
H = gg.multiChoice({
"test", 
"EXIT SCRIPT",},nil,"") 
if H == nil then else
if H[1] == true then test() end
if H[2] == true then os.exit() end
end
sys = -1
end
end
end
function test()
while true do
  if gg.isVisible(true) then
    sys = 1
    gg.setVisible(false)
  end
  if sys == 1 then
L = gg.multiChoice({
"test 2", 
"BACK TO MAIN MENU",},nil,"") 
if L == nil then else
if L[1] == true then test2() end
if L[2] == true then HOME() end
end
sys = -1
end
end
end
function test2()
gg.alert("hello")
end
while true do
  if gg.isVisible(true) then
    sys = 1
    gg.setVisible(false)
  end
  if sys == 1 then
    HOME()
 end
 end

 

 

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
×
×
  • 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.