Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextWindow interactive #4668

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

MillhioreBT
Copy link
Contributor

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

Modal windows allow interactivity and are very good and have a helper that makes it very comfortable to build complex window systems without so much code...

Some time ago in this PR I added tracking the ID of these classic windows.
This PR brings a bit of interactivity for classic text windows through an helper.

here I will show you an example:

data/scripts/creaturescripts/player/#text_window_example.lua

local reactWindow = TalkAction("!textWindow")

function reactWindow.onSay(player, words, param, type)
	local txtWindow = TextWindow({
		itemId = 1234,
		text = "Write something here:",
		canWrite = true,
		length = 100,
		callback = function(player, item, text)
			player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You wrote: " .. text)
			return true
		end
	})

	txtWindow:sendToPlayer(player)
	return false
end

reactWindow:register()

Issues addressed: Nothing!

@MillhioreBT MillhioreBT added the feature New feature or functionality label May 3, 2024
@EvilHero90 EvilHero90 added this to the 1.6 milestone May 14, 2024
@EvilHero90 EvilHero90 merged commit 1387a7d into otland:master May 14, 2024
4 checks passed
@MillhioreBT MillhioreBT deleted the text_window_helper branch May 15, 2024 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants