Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Script System

Author
Message
Slayer93
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: I wish I knew
Posted: 2nd Dec 2006 01:45 Edited at: 2nd Dec 2006 02:00
Here is a little or big script system I made.

The script system allows you too create commands and write scripts in files to parse to help you layout your game and run your game.

Creating a command is simple all you have to do is go to a function called parse_string() which parses a string. In there you are going to put a case/endcase statement between the select/endselect statement if you dont know what those are look in the help file or an existing project with mutliple commands already. For the data of the case statement put the command you will like to make. Once you have done that you will be able to get the parameters that have been taken out of the string in an array called psentences(). You can use those parameters to do what you want. Here is an example

eg.

case "text"
text val(psentences(0)),val(psentences(1)),psentences(2)
endcase

In a script file it will look like this text 0,0,Hello this is a test

Final notes on creating commands- in the case data it can only be one word. The psentences array is a string so you have to use the val() command to make it a value and sometimes the int() command if you need an integer for arrays and such.

I have also created a flag system. The flag system will allow you to run certain parts of your script at certain times. To make a flag in the script since I already made the command for you. You have to use a command called newflag (in the commands list with download). Then it will store commands for later use. To activate a flag when you want you have to use activateflag (also in commands list). You can only set the activation times the engine has or if you make your own using flagcheck. To create the flag in the engine you have to use a function thats called check_flag_data() and put check_flag_data(flagcheck$) in so you can use flagcheck. You can see an example of this within the project for download.

There is also a variable system in place to create your own variables. Variables will have to be created using the var command. You will be able to use a varible in any parameter since it changes a varible name into a varible value before it looks up commands.

Just keeps getting better and better right. I also have a lot of different functions you can use besides the parse_string and parse_file. You can store string words/parameters or just get the one you want with the list of function names in the project download.

store_words()
store_parameters()
get_word(string$,word)
get_parameter(string$,word)

A final note to use this make sure you Intiate the script system using Intiate_scriptsystem()

Try it out with this project and the commands list. See if you can make your own commands.

Script System-


flag data -


Example-


Working on Boxed for NVIDIA compo. Check it out

Mnementh
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location:
Posted: 2nd Jan 2007 04:49
zomgwtfbbq

I love the idea, this is perfect for a project I'm working on!

Keep up the good work.


--Did you know that 42% of all statistics are just made up?
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 18th Feb 2007 06:41
I can't get it to compile at all in 6.2, the problem seems to be in store_parameters, I'm betting the undimming/dimming of the arrays which always seemed glitchy to me. What version did you make this in?
Slayer93
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: I wish I knew
Posted: 4th Mar 2007 07:23
Sorry I haven't replied, after a month I didnt think anyone would post. I just tried it in the latest update, 6.4 I think, and it worked fine.

Current Project - Zio Engine: RPG Engine and OMMORPG

Login to post a reply

Server time is: 2024-11-23 00:16:08
Your offset time is: 2024-11-23 00:16:08