Variable to call a procedure

Is it possible to use a variable in a “call.name” to call a procedure?

Something like this

ProcedureCall

Name the Procedure sayHelloProcedure Invoke the Procedure by using the call sayHelloProcedure block (this block is created and available on your palette after you make the Procedure)

or do you want to do something else?

From the Books section of the AI2 FAQ

http://www.appinventor.org/bookChapters/chapter21.pdf

Hi, SteveJG. Thanks for your return, but I need a diferent solution. I’m creating an app like a text RPJ that have 400 procedures (texts). There´s only one button (rolling dices). Each procedure call the button blocks, but after button click, I have to return to procedure to continue the history. So the procedures change every time a call the dices. I need some solution to the button knows to which procedure returns

Thanks Abraham. I will read this chapter!

It appears you do not really want to to call a Procedure but you want a text to change. You probably want to use an IF…then …else if Blocks as described here: Chapter 18. Programming Your App to Make Decisions

You might benefit from the resources here to help you learn to use the AI2 tools A very good way to learn App Inventor is to read the free Inventor’s Manual here in the AI2 free online eBook http://www.appinventor.org/book2 … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here http://kio4.com/appinventor/index.htm and here http://www.imagnity.com/tutorial-index/ for more tutorials.

what about a table based solution? how many possibilities are there to continue afer rolling the dice?
each of the texts gets a number and a link to the next text depending on the dice result

for a table based solution let me recommend the local sqlite database, there are extensions available to access the database, for example my sqlite extension here App Inventor Extensions: SQlite | Pura Vida Apps (paid), there are also other (free) sqlite extensions available, for the extensions directory see here App Inventor Extensions | Pura Vida Apps... however: you get what you pay for...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

If you use a look up Table in your rpg game (if conditional statements are not sufficient), consider either of these sqlite extensions.

This one works great for me https://github.com/frdfsnlght/aix-SQLite

This one has a tutorial showing how to make a game, possibly similar to yours https://community.thunkable.com/t/free-sqlite-extension-sponsored/8802

Regards,
Steve

Hi Taifun, Follow the blocks of my app with a little explanation.

you first have to define all the dependencies and write them down
as far as I can see, the user always (?) has 2 different choices, in the example to go to 291 or 147 depending on dados and habilidades?

let's assume, it is as simple as this (most probably it isn't, you have to define all the dependencies and put them into the table), so currently you have 4 columns in your table (you most probably will have more)

action, text,          action1,        action2
1,      text of H1,    291,            147
2,      ...
...,    ...
147,    text of H147,  for example 22, for example 42
...,    ...
291 ,   text for H291, ...,           ...
    .

Taifun

For an example of encoding games in data files for an interpreter program,
search for scummvm games
https://www.scummvm.org/

Hi SteveJG, thanks for your help. It’s working now! It was a mix between calls and If Then blocks! I hope finish the app until 2020 ends.