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.

DarkBASIC Professional Discussion / Randomizing names help

Author
Message
Edy_Female
14
Years of Service
User Offline
Joined: 24th Dec 2011
Location:
Posted: 24th Dec 2011 19:48
Can anyone help me in Randomize names
Please look at example
need the name that randomize picks and it prints out x$
if it picks 7 then it goes to the next line and prints out x$

pl$=()

RANDOMIZE
1 sam 2 bill 3 tim 4 leu 5 ann 6 marry 7 Out to Lunch

10 print ;x$ " Says i am your Bank Teller,how may i help you" ;pl$
11 print ;x$ " Out to Lunch go to next window please"
wait 1000
end
endif

Having hard time with RANDOMIZE
Hope someone can help

email [email protected]

From Edy

New to DarkBasic Professional
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Dec 2011 21:46
No, you're not having problems with RANDOMIZE. Your problems are deeper than that.

Can I suggest that you start with the beginners guide to DBPro: http://forum.thegamecreators.com/?m=forum_view&t=137027&b=7

Then you can move on to other tutorials: http://forum.thegamecreators.com/?m=forum_view&t=115633&b=7

Edy_Female
14
Years of Service
User Offline
Joined: 24th Dec 2011
Location:
Posted: 25th Dec 2011 00:19
Can anyone help me in Randomize names
Please look at example
need the name that randomize picks and it prints out x$
if it picks 7 then it goes to the next line

pl$=()

RANDOMIZE
1 sam 2 bill 3 tim 4 leu 5 ann 6 marry 7 Out to Lunch
for x=1 to 7

10 print x " Says i am your Bank Teller,how may i help you" ;pl$
11 print x " Out to Lunch go to next window please"
wait 1000
end
endif

Having hard time with RANDOMIZE
Hope someone can help

email [email protected]

From Edy

IanM
All i need is x to say what ever the random picks out

who will it be
1 sam 2 bill 3 tim 4 leu 5 ann 6 marry 7 Out to Lunch

New to DarkBasic Professional
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 25th Dec 2011 05:27
This will work for you. You really should check out the beginners guide and tutorials, IanM suggested.



WickedX
Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 25th Dec 2011 10:44
ok this is embarassing given that i've been darkbasic'ing for the past 10 years and have never used the data/read commands mentioned in the above snippet. I decided to look them up now and it seems that the benefit to it is that you can call 'data' with values at any time, and the next string/integer/float to call the read command gets those data values?

i.e.


the point to it is that you vary which arrays/values get the data, rather than manually specifying it?
I can still do it without using data/read I guess that's why i've never used them? is there something i'm missing?

Another thing i'm super duper ridiculously confused about is that in that snippet the data command is placed at the END of the code? huh? doesn't it have to be called first otherwise read would return nothing?
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 25th Dec 2011 17:06
Every command in DarkBasic Pro is there for a reason. If you familiarize yourself with DATA, READ and RESTORE, I’m sure you will realize its benefits. The DATA statement can go anywhere within the body of the code. The READ statement reads the data from the beginning sequentially.

data rnd(100),rnd(100)

This will generate an error. You cannot use a function in a data statement.

Disclaimer on first sentence: I really don’t want this to be another GOTO debate. But in my opinion it even has its use. The SLEEP command on the other hand in the core dll C++ source is identical to WAIT.
SoftMotion3D
AGK Developer
20
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 25th Dec 2011 18:51
yiks! lol

The data statements and using arrays are essential to keep things organized. Any big project should have some organization to it so you dont get things mixed up.

A good example would be a tile based map. Say your array has all the collision objects stored and you would only need to test collision in that array area rather then checking everything.

An example of creating some ai... maby you have an array name
myai(10,10) 10 characters with 10 memory areas to store things...

maby the first three report position of the character
the next can report his life...what weapon etc
and a value stating what the characters doing and another for how long he plans on doing it.

based on a counter running down in that array you randomly select a new task for that character based on his position ....maby he hit a wall and needs to turn around or he has spotted ya in his sights and should follow ya to attack.

Ai alot of that is random but also you can make it smarter by narrowing down what the dude should be doing in his current situation.

Anywho....is funny you just learned about the data statements after 10 years. I guess ive been doing this for 15 to 20 now...lol

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Dec 2011 23:13
@Edy_Female,
I understand what you wanted, but getting people to write the code for you without you having any background in DBPro isn't going to help you learn anything - you are missing the very basic principles of DBPro.

Hence my suggestion of looking through the tutorials - Just a couple of them would have you writing the code yourself within a very short time, and more importantly, you'd know how and why you used each of the statements in your code.

Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 26th Dec 2011 02:17
not to make this thread about me but

Quote: "based on a counter running down in that array you randomly select a new task for that character based on his position ....maby he hit a wall and needs to turn around or he has spotted ya in his sights and should follow ya to attack.

Ai alot of that is random but also you can make it smarter by narrowing down what the dude should be doing in his current situation."


I don't see how data/read/restore is going to do anything that I can't do anyway? When I say i've been doing dbpro for 10 years i've written some fairly good programs, including AI routines and never had to use data. It's very easy to determine random actions with a simple rnd() based on percentage, of which the tasks are determined by circumstances, and then run the appropriate sub routines which handle everything from collision to weapon firing to netcode. So it's for this reason i'm not sure what its relevance is because I don't see how it can really simplify anything by much at all?
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Dec 2011 11:05
Data is useful when the data is hard coded in the code. I generally find that by using external datafiles you have an expandable system capable of being changed without having to recode the source.

I just don't use the data command at all these days. xml files do it for me know!

My signature is NOT a moderator plaything! Stop changing it!
Edy_Female
14
Years of Service
User Offline
Joined: 24th Dec 2011
Location:
Posted: 28th Dec 2011 18:18

Im going to be getting a new computer January of this comming month on the third....What i need to know is this....
My new computer that i am getting with have Windows 7
will i be able to use DarkBasic Profssional ?

here is what i will be buying

The eMachines EL1358G Desktop is space saving and affordable featuring reliable AMD Athlon II processing, rich graphics performance and plenty of storage space for all of your media and files. And with Microsoft Office Starter 2010, Windows 7 Home Premium Operating System and front accessible ports, it is simple to have fun with your digital media, keep in touch with friends and tackle tasks with ease.
eMachines EL1358G-51w Desktop PC:

Key Features and Benefits:

•AMD Athlon II X2 Dual-Core 220 processor
2.8GHz, 1MB Cache

•3GB DDR3 SDRAM system memory (expandable to 4GB)
Gives you the comfort for multimedia videos and images, video conferencing, basic gaming and all the other simple duties

•1TB SATA hard drive
Store 666,000 photos, 285,000 songs or 526 hours of HD video and more

•16x SuperMulti DVD Burner
Watch movies, and read and write CDs and DVDs in multiple formats

•10/100/1000 Gigabit Ethernet
Connect to a broadband modem or wired broadband router with wired Ethernet

•Integrated NVIDIA GeForce 6150SE Graphics
Additional Features:

•6-in-1 memory card reader
•6 x USB 2.0 ports, 1 x VGA port, 2 x PS/2 ports, 1 x headphone jack, 1 x microphone jack, 1 x RJ-45 Ethernet port, 3 x audio ports
•1 x PCI Express (x1) slot, 1 x PCI Express (x16) slot, 1 x 5.25" bay, 1 x 3.5" bay
Software:

•Genuine Microsoft Windows 7 Home Premium 64-Bit Edition (To learn more about the features of Windows 7, click here)
•Microsoft Office Starter 2010: Includes reduced functionality versions of Microsoft Word and Excel, with advertising. PowerPoint or Outlook are NOT included. Purchase Office 2010 today and get the most out of your new PC. (To learn more about the features of Office 2010, click here)
•Norton Internet Security (60-day trial)
•Backup and Restore options built into Windows allows you to create safety copies of your most important personal files, so you're always prepared for the worst
Support and Warranty:

•1-year parts and labor limited warranty; Toll-free tech support
•Restore discs are no longer included with PCs. We recommend you use the installed software to create your own restore and backup DVD the first week you use the computer.
What's In The Box:

•Power cord
•PS/2 keyboard
•PS/2 mouse
•Quick Start Guide

From Edy

thanks for the help

New to DarkBasic Professional
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 29th Dec 2011 01:02
It should work just fine.
You might have to set up some privilieges etc. for which there are tutorials floating around these boards.


As for the data block, I've never seen any great use for them either.
They seem to allow simple input of some structure that you might use in a (really) small test program, but for anything more serious you'd want to use files for data storage. As for the internal data I'm fine with arrays, udt's and, failing that, my macho raw memory access "class" simulations that are beautiful when working although bothersome to write and a nightmare to debug.


"Why do programmers get Halloween and Christmas mixed up?"
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Dec 2011 13:05
Quote: "My new computer that i am getting with have Windows 7
will i be able to use DarkBasic Profssional ?"


Just look at this thread and follow the links (near the top of this board - it's there for a reason ).

DBPro Operating System Compatibility Thread

Login to post a reply

Server time is: 2026-07-10 00:43:22
Your offset time is: 2026-07-10 00:43:22