forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Create Controls at Runtime....
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
bupaje
Newbie


Joined: 28 Apr 2003
Posts: 5

PostPosted: Tue Apr 29, 2003 6:09 pm    Post subject: Create Controls at Runtime.... Reply with quote

Hello,

I just discovered Visual DialogScript yesterday and am wondering if it might allow me to make some small utilties I had in mind. I was wondering if the following is possible, and if it is, if any samples are avaliable or a basic 'talk through' of what I need to do so I can try with the demo.

I am a new user of 3D Game Studio at www.conitec.com and like here many people share code. I was thinking it might be nice to be able to create a template for code and then have a program -which is what I want from VDS- to read the text file, generate a wizard based on the info and allow users to enter values and output the customized code. Know this sounds confusing so here is an example.

Say I created this code
Code:
function vehicle_jumps()
{
     if (my.skill40 == 1) {return;} // disable multiple jumps
     snd_play (jump_wav, 30, 0);
     my.skill40 = 1;
     while (my.z < 300)
     {
          vehicle_speed.z = 5 * time;
          wait (1);
     }
     while (my.z > 20)
     {
          vehicle_speed.z = -5 * time;
          wait (1);
     }
     vehicle_speed.z = 0;
     my.z = 20; // restore the exact vehicle height
     my.skill40 = 0; // allow a new jump
     snd_play (landed_wav, 30, 0);
}

and I wanted to share it. I'd like to be able to create a template like so (I'd do this manually. Want VDS to read/parse this. This is a 'madeup' example so the code may not make sense)...
Code:
[START-WIZARD]
CREATE SCROLLBOX (VEHICLE-SPEED-1,1,10,5,"Set initial speed for normal driving 1-10, default is 5")
CREATE SCROLLBOX (VEHICLE-SPEED-2,1,20,10,,"Set turbo speed for burst 1-20, default is 10")
[END-WIZARD]
[START-CODE]
function vehicle_jumps()
{
     if (my.skill40 == 1) {return;} // disable multiple jumps
     snd_play (jump_wav, 30, 0);
     my.skill40 = 1;
     while (my.z < 300)
     {
          [VEHICLE-SPEED-1]
          wait (1);
     }
     while (my.z > 20)
     {
          [VEHICLE-SPEED-2] 
          wait (1);
     }
     vehicle_speed.z = 0;
     my.z = 20; // restore the exact vehicle height
     my.skill40 = 0; // allow a new jump
     snd_play (landed_wav, 30, 0);
}
[END-CODE]

The basic idea I have would depend on VDS's ability to read the file and generate a wizard based on the controls needed as described in [START-WIZARD] here [END-WIZARD] with this example creating a scrollbox that would have max and min values set and default and a tooltip help description.

Ideally I'd eventually be able to do something like this as well
Code:
[START-WIZARD]
[TAB-1]
CREATE SCROLLBOX (VEHICLE-SPEED-1,1,10,5,"Set initial speed for normal driving 1-10, default is 5")
[/TAB-1]
[TAB-2]
CREATE SCROLLBOX (VEHICLE-SPEED-2,1,20,10,,"Set turbo speed for burst 1-20, default is 10")
[/TAB-2]
[END-WIZARD]

as some code samples are long. The idea being that a newbie can take a teplated script and modify it safely and add to his code even if he doesn't understand every element once someone who does turns it into a shareabel template.

Sorry for long explanation, tend to think as I write. Smile

Code-tags added by moderator for better readability.
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Tue Apr 29, 2003 6:17 pm    Post subject: Reply with quote

Quote:

which is what I want from VDS- to read the text file, generate a wizard based on the info and allow users to enter values and output the customized code


hummm well i can say that vds can read a txt file and i bet you could make button that will let you chnage VEHICLE-SPEED, etc BUT to generate a wizard that part i'am not sure on...may some one on the forums could answer that for ya...

_________________
Have a nice day Smile
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Tue Apr 29, 2003 6:21 pm    Post subject: hummmm Reply with quote

humm i was thinking what ya mean by wizard??? cuase if you are just after making it easyier for the user to make thsese adjustments then you won't need a wizard...just make a mian window that would load the "config file" then the users would click on the buttons that would let them enter in the numbers need or whatever you want them to "adjusted"

i hope i explain this well hard to explain....

_________________
Have a nice day Smile
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Apr 29, 2003 6:22 pm    Post subject: Reply with quote

It is possible to write files this way:

Code:

list create,1
list add,1,CREATE SCROLLBOX (VEHICLE-SPEED-1,1,10,5,"Set initial speed for normal driving 1-10, default is 5")
list savefile,1,@path(%0)outputfile.txt


If you want to get featback from users, use it like this:

Code:
  DIALOG CREATE,Wizard,-1,0,163,74
  DIALOG ADD,EDIT,EDIT1,22,2,48,19,1
  DIALOG ADD,EDIT,EDIT2,22,54,52,19,10
  DIALOG ADD,EDIT,EDIT3,22,110,52,19,5
  DIALOG ADD,TEXT,TEXT1,4,4,,,Scroll speed:
  DIALOG ADD,BUTTON,BUTTON1,48,62,64,24,Do it!
  DIALOG SHOW

rem This will wait for events, to load code...
:Evloop
wait event
goto @event()

:Button1button
list create,1
rem This will save it to a file. @DLGTEXT() gets the value of his parameter (EDIT1, EDIT2, Etc.)
list add,1,CREATE SCROLLBOX (VEHICLE-SPEED-1,@dlgtext(edit1),@dlgtext(edit2),@dlgtext(edit3),"Set initial speed for normal driving 1-10, default is 5")
list savefile,1,@path(%0)outputfile.txt
info File created!
goto Evloop

:Close
exit


You can design dialogs by pressing the F2 key in your script...

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Tue Apr 29, 2003 6:24 pm    Post subject: Reply with quote

yup that is what i was thinking to Skit3000...a main window that would load the txt then have buttons
_________________
Have a nice day Smile
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Apr 29, 2003 6:34 pm    Post subject: Reply with quote

Maybe you should give an example the next time too? BTW. I had not seen your post(s) before I posted... Think I was too slow... Wink
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Tue Apr 29, 2003 6:50 pm    Post subject: Reply with quote

well mater of fact...i was thinking of posting one but ya beat me to it....heheheh Smile
_________________
Have a nice day Smile
Back to top
View user's profile Send private message
bupaje
Newbie


Joined: 28 Apr 2003
Posts: 5

PostPosted: Tue Apr 29, 2003 6:51 pm    Post subject: Reply with quote

Wow! Quick response. Smile Thanks for the feedback all and Skit3000 for the code. I am going to try this in a minute using the demo.

Just to better explain why I want to generate the controls like that was because some code samples may have say 1 listbox, 1 scrollbar -in other words fewer user changeable inputs and some may have 10-20 variables user can change.

Thanks very much -off to try this. Smile

Burt
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Apr 29, 2003 7:25 pm    Post subject: Reply with quote

Welcome to the forums Burt. Hi

I changed Skit's code around to fix some bugs and add a few more
features. Also note that when creating strings you should put quotes
around it if it has commas in it. For example:

WRONG!!
Code:
INFO Hello, and welcome.


RIGHT!!
Code:
INFO "Hello, and welcome."


Here's the modified code:

Code:
TITLE Scrollbar Wizard
  DIALOG CREATE,Scrollbar Wizard,-1,0,173,149,NOMIN
  DIALOG ADD,STYLE,RED,,,,,DD0000
  DIALOG ADD,STYLE,BOLD,,,B,,
  DIALOG ADD,EDIT,EDIT1,20,6,48,19,1,,BOLD
  DIALOG ADD,EDIT,EDIT2,20,58,52,19,10,,BOLD
  DIALOG ADD,EDIT,EDIT3,20,114,52,19,5,,BOLD
  DIALOG ADD,TEXT,TEXT1,4,4,,,Scroll speed:,,RED
  DIALOG ADD,BUTTON,Create,46,6,64,48,Create,,BOLD
  DIALOG ADD,RADIO,Output,42,74,92,54,Output To,Text File|Clipboard,Clipboard,,RED
  DIALOG ADD,TEXT,TEXT2,104,6,,,Filename:,,RED
  DIALOG ADD,EDIT,FILENAME,102,58,108,19,wizardoutput.txt,,BOLD
  DIALOG ADD,STATUS,Status,Ready,BOLD
  DIALOG SHOW

REM -- This is the event loop. It waits for an event until one is created and then goes to the corresponding label --
:Evloop
wait event
goto @event()

:CreateBUTTON
REM -- Check to see which operation was specified --
if @equal(@dlgtext(Output),Text File)
list create,1
REM Be sure to put
list add,1,"CREATE SCROLLBOX (VEHICLE-SPEED-1,"@dlgtext(edit1)","@dlgtext(edit2)","@dlgtext(edit3)",Set initial speed for normal driving 1-10, default is 5")
list savefile,1,@dlgtext(filename)
REM -- Closes the list so that it can be used again --
list close,1
REM -- You can also use the @FileDlg() function to make a file prompt dialog --
dialog set,status,"File saved as "@dlgtext(filename)
else
clipboard set,"CREATE SCROLLBOX (VEHICLE-SPEED-1,"@dlgtext(edit1)","@dlgtext(edit2)","@dlgtext(edit3)",Set initial speed for normal driving 1-10, default is 5")
dialog set,status,Copied to clipboard
end
goto Evloop

:Close
exit

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
bupaje
Newbie


Joined: 28 Apr 2003
Posts: 5

PostPosted: Tue Apr 29, 2003 8:22 pm    Post subject: Reply with quote

Thanks FreezingFire. I'm going to try all this when I get home -stealing some time here at work right now. Smile Looking forward to seeing what can be done.
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Apr 29, 2003 9:19 pm    Post subject: Reply with quote

I can assure you that using VDS to make a program that allows for
dynamic wizards is more than possible. In fact, I'm working on a
program right now that does this. It seeks out specific criteria, then
builds a dialog based on what it finds, then allows the user to select
information from a drop down box, or enter information from an input
box.

It's not an easy project though, and you will need to become really
familiar with VDS if you want to make this happen for you.

I do apologize, but at this time I do not have any code I can share with
you for this. Sad

But here's some hints. You'll be wanting to get familiar with the following
functions:

@pos()
@substr()
@strdel()
@strins()
@len()
@sum()
@diff()

Commands that you'll be wanting to look at:

IF/ELSE/ELSIF/END
REPEAT/UNTIL
WHILE/WEND
LIST CREATE
LIST LOADFILE
LIST SEEK
LIST SAVEFILE
OPTION FIELDSEP
PARSE

Those are some of the most important functions and commands that you
will need for this.

If I could, I'd toss together an example, but two things keep from doing
that at this time... The code I have is close to 2500 lines and... I don't
have the time to try and take all of that and compact it into a small
working example right now. Sad

Mainly though, I just want to let you know that this is more than possible
for you to make using VDS.

-Garrett
Back to top
View user's profile Send private message
bupaje
Newbie


Joined: 28 Apr 2003
Posts: 5

PostPosted: Tue Apr 29, 2003 9:36 pm    Post subject: Reply with quote

Thanks for the pointers Garrett, I'll check them out. No prob on the code, if you are working on a project I certainly understand. I just downloaded a bunch of samples -be in big trouble if the boss comes in. Wink I have plenty of ideas -lets just see if I got the brains. Thanks again -cool forum that's for sure as well.
Back to top
View user's profile Send private message
DW
Contributor
Contributor


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Tue Apr 29, 2003 9:52 pm    Post subject: Reply with quote

Welcome to VDS, I myself am a new user and am loving it so far.
I think you should be able to do as you ask maybe even more.
The VDS team on this board rock, I know they will help you with anything.
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Apr 29, 2003 9:58 pm    Post subject: Reply with quote

If you take a look at the example included with the installation of VDS,
called WIZARD.DSC, it might give you an idea of a nice wizard. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1566

PostPosted: Wed Apr 30, 2003 3:18 am    Post subject: Reply with quote

Welcome to vdsworld Smile I wanted to comment on 3d GameStudio, for those that haven't tried it, this is one of the best game development packages out there. You can easily create professional 3d games with this tool with ease and since many of us here already have experience with programming using the c type code in 3dgamestudio should be no problem. Okay enough of the infomercial, glad to see you here. I'm sure you will find VDS will work hand-and-hand with 3dgamestudio. Posting here on the forums is one of the best way to get your questions answered, also trying the examples and searching the help file for answers is always a great way to learn as you program.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group