-1

I want to make a multi-device software with godot that allows you to enter to a specific webpage that is recorded. I mean, you press a button, then a container appears, in the container you write the page and then, every time you touch the software icon, it automatically takes you to the page. But I have no idea how to do it.

All the code I have is:

func _on_Button_pressed():

OS.shell_open("webpage")

inside a button node.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

So the user opens your application and it immediately redirects to a saved URL if there is one, otherwise it prompts them to pass in a URL.

You could use a generic Node when you first load the app in order to determine whether to redirect or prompt for a URL.

It's pseudo code, but the main scene might look something like this:

extends Node

func _ready():
    var saved_url = Persistence.load_saved_url()
    if saved_url != null:
        OS.shell_open(saved_url)
    else:
        get_tree().change_scene("res://AskForURL.tscn")

Of course, you'll need to actually implement persistence. And you might want to consider a way for them to edit the url if they type it in wrong, rather than redirecting immediately.

JarWarren
  • 1,343
  • 2
  • 13
  • 18
  • i just see your answer. Thank you bro –  Jul 28 '20 at 22:37
  • I just have one more question. Which node i should use for asking for the url?. I mean, i couldn't find a node wich text is editable –  Jul 28 '20 at 22:39
  • I would use LineEdit https://docs.godotengine.org/en/stable/classes/class_lineedit.html#class-lineedit I also recommend that your URL prompt scene is composed of Control Nodes since it's more of a UI than a game. – JarWarren Jul 28 '20 at 22:43
  • Thank you bro I will try it –  Jul 28 '20 at 22:49