0
Completed - Resolved

Mighty Script - Print Random Number with In Game Message shows always "null"

SeriousToni 4 years ago updated by anonymous 4 years ago 21

Create a new number (integer).

Create a script that generates a random number on the previous created integer. 

Print the integer now to the player's screen (e.g. with a "Show Ingame Message" and as content you select the integer).

Export and Quicktest the map.

Ingame Message shows always "null" - no matter how often you fire the script and generate numbers.

Game Version:
GOG Galaxy
Platform:
Windows
GOOD, I'M SATISFIED
Satisfaction mark by SeriousToni 4 years ago

How were you displaying the Number?

You usually need to display it as something like "Your number is [0]" with the [0] getting replaced by the actual Number variable.

Instead of the text message I chose the variable via the pick item button to the right. 

You need to pick a variable as well as choose the text that displays with it. As per my example above "Your Number is [0]". the [0] is the bit you picked with the pick item button, but without actually adding that to the text to tell the game I want my variable to be here, there is nothing to display.

Completed - Resolved

If the above still returns null the get back to us, Nutter is correct

Can I put whatever I want in the brackets and the var which I chose on the right will be used or how do I Adress this var in my text? Is there a tutorial I was missing or from where do I get that information? I will then check this and respond here. 

You need to use [0] which is a reference to the variable itself (if it was a list of variables it would be the first variable in the list and [1] would be the second variable in the list)

So you literally need to try: "Your text here [0] more text here" and the [0] gets replaced into and displayed "Your text here 1 more text here"or whatever the variable number.

As for where I got the information, there is no tutorial (yet). I know because I helped test MightyScript before it was released and this is one of the things I worked with Nano to get working properly.

It does not work correctly. With the in game main message trigger I can not choose one of my numbers at all. (no items for that picker in this map available) and if I try to use the chat message trigger I CAN choose one of my numbers but I am unable to type text (as you said) in the input field anymore (the name of the number is in there now) 

Have definitely you created a number variable first ready to use?

EDIT - Can you screenshot how the action screen looks?

+1

Huh looks like something is definitely wrong there then. @Cian needs to re-open the ticket.

+1
Marked for Review

Reopening ticket. If possible could you send us the map files you're working from? These should be in your maps folder with the initial title you set for the level when creating it followed by "_edit" we'll need the meta data as well.

+1
Backlog

Updating this ticket to reflect that is currently pending our next triage pass. (Our programmers are currently heads down on other projects and we're trying to slot in some time for WFTO after upcoming major milestones in early 2019)

+1

Show Ingame Chat should have allowed you only to select a string not an integer. I fixed that.

So the way to show on screen a random number is to create the Number, create two Lists of type strings. First one should have the base text, for example “This is a random number:” and second one left empty.

In the trigger actions

  1. Generate random number
  2. Add String, use the first string as base, the int as random number and the second string as output
  3. Show Announcement, use the second string to show the text
+1
Completed - Next Patch

Thank you for your fix and the short answer - still could you please explain a little more what you mean in point 2? With the base and the output? Thank you, I would love to hear more details on this to try it out for myself :)

+1

Sorry about the delay, sure thing !

In my example BaseString is set with "This is a random number : "

GeneratedString is left empty, it is built during the Add To String

And RandomNumber is set during the Math Random action

Here, I hope it makes enough sense:

Thank you so much for the detailed information. No need to apologise! 

I am sorry for the inconvenience, I feel like I should know this but the current Map Editor Tutorial is lacking this feature. I would love to help making part 2 of the guide but I feel I am not experienced enough to help out make a decent and high quality tutorial. I hope some of the experienced people or even one of you developers could make a Map Editor Tutorial part 2, covering advanced things like this. I wish you good luck on the further things to do and I don't take anything for granted. So thank you very much seriously !! 

Completed - Resolved