Store Language Stack

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Store Language Stack

Post by a_bertrand »

The next step of my engine in my opinion is to open the door to more complex coding involving game owners to develop things like player market or auctions.

For that a couple of things need to be implemented like:
- Being able to show a "dialog"
- Being able to put some stuff on the dialog with input boxes, buttons and more
- Being able to process those inputs and react to the buttons
- Being able to save data for the game like "object on sale", query, update and delete those entries

Up to the last point all is pretty clear and easy to implement even if you will not use HTML to fill the form but more an enhanced BB code to avoid XSS and nasty JS injections.

The last point however requires async calls, as the call will basically call back the backend and receive the data from it. Ideally the script should be blocked till the result come back and therefore makes the script coding much easier like:

Code: Select all

var toShow="";
var query=Storage.Select('itemsOnSale');
while(Storage.NextRow(query))
{
   toShow+=Storage.GetValue('Name')+"\n";
}
Display.Dialog(toShow);
To be able to do that, I need to store my script stack after the Storage.Select and restore it when I get the data from the server, however I believe I will have to heavily touch my scripting language to be able to do so. Annoying.

What do you think? Would you prefer a linear call like in this example or a system with callbacks?
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Store Language Stack

Post by hallsofvallhalla »

man that is a tough one. I like what you are trying to do here but i could understand if it is to much changing of your current script system. I think in the end as long as the feature is there players will be happy.
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Store Language Stack

Post by a_bertrand »

I think I got it running... wasn't all that simple really:
https://www.dotworldmaker.com/test_parser.html

Click on the "test" button, and you should see a couple of messages coming then a pause then it continues. The stack should be preserved with all the variables values and everything... Hopefully...
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Store Language Stack

Post by hallsofvallhalla »

Dude thats quite awesome
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Store Language Stack

Post by a_bertrand »

Thanks... was more complex than I expected and took a lot more time than expected to have it working. That's how it works:

I have now a new function in my script env which "stores" the current stack and once the stack has been saved in a JS object it pass that stack to a callback function.
The function can then do whatever it want and then "rebuild" the script env from the stack and the script env will be back at the same position as before and continue the execution, with all the loops, ifs, function calls stacked exactly as they was.
Creator of Dot World Maker
Mad programmer and annoying composer
Post Reply

Return to “Advanced Help and Support”