How To

String array error


crosoft312 2021-05-31 00:23 (Edited)

Hello! I had an account issue, and I made a knew one.

Anyways, I was making a text adventure. And you need to split the user input into two words, the verb and the noun. So, you have to find the space. So, you have too loop through each charactor in a string and find the space.
When I try: string$(x). It says ERROR: ARRAY NOT DEFINED. What Am I doing something wrong? Any help would be apreachiated. Thanks in advance!

Timo 2021-05-31 08:02

You can use the INSTR function to find the space and the LEFT$, RIGHT$ or MID$ to get the parts. Please check the manual for these functions.

was8bit 2021-05-31 13:34

Check out this code :)

Command Code.nx | Open in app
2021-05-31 13:34

crosoft312 2021-05-31 15:22 (Edited)

Thank you! Very helpful, exactly what I was looking for.

was8bit 2021-05-31 21:35 (Edited)

Cool ... glad i could help :)

Text games can be fun... be mindfull of the screen size...

also if you use PRINT there is a way to set up a text window, so instead of the whole screen being printed to, you can use a window (or defined area) to control the text inside a smaller area instead of using the whole screen...

I prefer using TEXT and NUMBER to display data to the player, but when asking the player questions and getting their input, PRINT and INPUT are needed...

crosoft312 2021-05-31 23:21 (Edited)

I'm sorry, I don't understand. Do you mean making the text smaller? Or just putting it in a specific spot to make it look better?

was8bit 2021-06-01 02:19

I will post an example :) ....

Window Example.nx | Open in app
2021-06-01 02:19

was8bit 2021-06-01 02:23 (Edited)

PRINT auto scrolls the text for you, and so by limiting its scrolling window you can use text or number or decorate the edges in my example (skip the full screen demo) and then you can use PRINT without the auto scrolling overwriting anything you have put on the edges....

was8bit 2021-06-01 02:36

A polished example...

Window Example 2.nx | Open in app
2021-06-01 02:36

crosoft312 2021-06-01 17:16 (Edited)

Got it! Thanks for making this! it was helpful!

was8bit 2021-06-02 00:37

Glad to be helpful :)

Log in to reply.