2019-08-09 04:57:47

IN my challenges we shouldn't play topic, someone came up with the reverse post challenge. So I countered that with a bgt script to reverse their post. Only problem is, the line, "clipboard_read_text;" causes the alert not to appear. Here is my code.

string text="";
void main()
{
show_game_window("reverse challenge");
text=input_box("input text", "");
//not sure if text box is needed to read text from clipboard
clipboard_read_text;
//causes an error for the alert
text=string_reverse(text);
//reverse the text that you pasted from clipboard
alert("post 28", text);
exit();
}

2019-08-09 21:10:59

Hi,
In your case, You don't need an input box, Because from what i understand you want to reverse what's stored on your clipboard, So you should cut out that part.
And, If i got you correctly about what you want to do (Reversing what's on your clipboard), You should declare a variable for your clipboard text and asign "clipboard_read_text" to it, And then reverse it.
What you could also do is to wrap them all in your alert box. Here's your edited code with both forms.
First form:

void main()
{
string clipboard_text = clipboard_read_text();
// Storing what's on our clipboard
clipboard_text = string_reverse(clipboard_text);
// reversing the stored text we retreeved
alert("Post 28", clipboard_text);
// And this is the alert box showing what it should
exit();
}

Second form:

void main()
{
alert("Post 28", string_reverse(clipboard_read_text()));
// And this is the alert box showing what it should
exit();
}

Co-founder of Sonorous Arts.
Check out Sonorous Arts on GitHub: https://github.com/sonorous-arts/

2019-08-10 11:07:37

I didn't put a left and right parenthesis after read_text. That's why it was not letting me treat it like a variable. I have used the function before, but I didn't need parentheses. But now I know if I want to treat it like a variable I need them. I thought about putting them, but didn't do it. Why? I don't know. But thanks for clearing that up