Go Back   getDare Truth or Dare > Tangents > Lounge > Advice Section

Reply
 
Thread Tools Display Modes
Old 02-08-2011, 05:12 PM   #1
Leopard
Truth or Dare Enthusiast
 
Join Date: Oct 2009
Posts: 2,522
Swatch Advice Wanted: Creating a Random Database

*

Problem solved; thank you to everyone for their quick and clever answers!

*

Okay so I'm making a Thing and it'll have a whole bunch of entries, then I want it so that I can basically just click something and it'll retrieve one of those entries at random.

I want this to be:
[list][*]Relatively simple[*]Private[*]Easy for me to access (i.e. not taking three hours to get a random thing chosen)[*]Easy to add more entries to

I know how to do this in Flash, but that wouldn't really be easy to add new entries to. I could also just number them and get a number from random.org, but that would be annoying.

I don't know anything about programming really, so no C++ etc.

I can use Flash, any Office app, anything online.

Any assistance is much appreciated.

Last edited by Leopard; 02-08-2011 at 05:53 PM.
Leopard is offline   Reply With Quote
Old 02-08-2011, 05:17 PM   #2
OneMoreTime
getDare Sweetheart
 
OneMoreTime's Avatar
 
Join Date: May 2010
Location: CA
Posts: 291
Default

javascript would make things rather easy

there is a neat function VAR.push("text"); that lets you ad a new entry to an array quickly. then you can use a standard random number puller script.

You just need somewhere to host the script

Last edited by OneMoreTime; 02-08-2011 at 05:26 PM.
OneMoreTime is offline   Reply With Quote
Old 02-08-2011, 05:22 PM   #3
nerdboy
Senior Member
 
nerdboy's Avatar
 
Join Date: Dec 2010
Location: Australia
Posts: 146
Default

A couple of things to know.

Is this going to be published online?
Do you mind using database at all?

I'm thinking of creating a simple webpage when you can enter entries and randomly pick them out (using PHP).
nerdboy is offline   Reply With Quote
Old 02-08-2011, 05:24 PM   #4
Leopard
Truth or Dare Enthusiast
 
Join Date: Oct 2009
Posts: 2,522
Default

In this instance it's going to be entirely private, so probably not online.

Database things are fine assuming it's something I can set up reasonably easily (i.e. if someone just gives me the basic example for 1-2 entries and I add however in manually myself.)

I'd need to install some sort of PHP server to use it on my own computer, wouldn't I?

I'm pretty good with software in general, just not a programmer or web developer, so while I can figure things out when I have something to start with, no good at building it from scratch.
Leopard is offline   Reply With Quote
Old 02-08-2011, 05:28 PM   #5
focki
Member
 
focki's Avatar
 
Join Date: May 2010
Location: Online (Europe)
Posts: 99
Default

The simpliest solution would be to do it in MS Excel. A bit harder, but still easier than configuring Apache or IIS would be MS Access. You can PM me for tips.
__________________
29F+29M

Likes:
HER: orgasms, light pain, bondage, sex, roleplay, spanking, no-risk humiliation
HIS: the same from dominant side

Dislikes:
HER: pee (giving), wax
HIS: pee (receiving), wax, anal
BOTH: ice

Limits:
BOTH: no to strangers, too public, crossdressing, heavy pain, poo, permanent, blood, wedgie, own pee, dangerous
HER: pee receiving

Ask HER: http://www.getdare.com/bbs/showthread.php?t=132082
focki is offline   Reply With Quote
Old 02-08-2011, 05:29 PM   #6
OneMoreTime
getDare Sweetheart
 
OneMoreTime's Avatar
 
Join Date: May 2010
Location: CA
Posts: 291
Default

I can hack together a normal html page with javascript plugged in. take all of 20 seconds lol.
OneMoreTime is offline   Reply With Quote
Old 02-08-2011, 05:30 PM   #7
Leopard
Truth or Dare Enthusiast
 
Join Date: Oct 2009
Posts: 2,522
Default

I can do excel, though html would definitely be more appreciated, assuming it runs self contained (no extra servers etc.)

Quote:
Originally Posted by OneMoreTime View Post
I can hack together a normal html page with javascript plugged in. take all of 20 seconds lol.
Would be much appreciated
Leopard is offline   Reply With Quote
Old 02-08-2011, 05:33 PM   #8
nerdboy
Senior Member
 
nerdboy's Avatar
 
Join Date: Dec 2010
Location: Australia
Posts: 146
Default

Simplest thing I can think of is, Microsoft Access, if you're running on Windows.

Or, just like OneMoreTime says, Javascript could be a good one too.. It can be run locally on your computer, without the need for hosting or database.

I can give give you a sample, but need to wait another 6 hours - after I finish work ;p
nerdboy is offline   Reply With Quote
Old 02-08-2011, 05:37 PM   #9
OneMoreTime
getDare Sweetheart
 
OneMoreTime's Avatar
 
Join Date: May 2010
Location: CA
Posts: 291
Default

thinking more, javascript cant actually write to a file. So entries would have to be entered manually in the the file, but they could be retrieved just fine.
OneMoreTime is offline   Reply With Quote
Old 02-08-2011, 05:40 PM   #10
wsedrf69
Member
 
wsedrf69's Avatar
 
Join Date: Feb 2009
Location: Canada
Posts: 35
Default

This has been tested in a Google Docs spreadsheet, but may also work in Excel (though I promise nothing).
  • Enter your list items in the first column
  • Enter the length of the list in cell B2
  • Copy this formula into some cell: "=INDIRECT(ADDRESS(RANDBETWEEN(1,B2), 1))"
  • Your randomly selected list item will appear where the formula was entered
  • Profit?

You can refresh the random choice with Ctrl-R.
wsedrf69 is offline   Reply With Quote
Old 02-08-2011, 05:43 PM   #11
Leopard
Truth or Dare Enthusiast
 
Join Date: Oct 2009
Posts: 2,522
Default

Quote:
Originally Posted by OneMoreTime View Post
thinking more, javascript cant actually write to a file. So entries would have to be entered manually in the the file, but they could be retrieved just fine.
That'd be just fine. No problem manually entering everything, I just mean I can't do things like create a script from nothing myself.



Wise; Thanks a lot, will check that out. Though a html file would be ideal for me, I think.
Leopard is offline   Reply With Quote
Old 02-08-2011, 05:45 PM   #12
OneMoreTime
getDare Sweetheart
 
OneMoreTime's Avatar
 
Join Date: May 2010
Location: CA
Posts: 291
Default

HTML Code:
<script type="text/javascript">
/**
Simply add the following to the code to make either new truths or dares 
dare.push("blah"); 
truth.push("blah"); 
**/
var dare = new Array();
        dare.push("dare 1");
        dare.push("dare 2");

var truth = new Array();
        truth.push('truth 1');
        truth.push('truth 2');

                
function rotate_dare()  {
        var i = Math.floor(Math.random()*dare.length);
    document.getElementById('dare_content').innerHTML = dare[i];
        document.getElementById('dice_roll').innerHTML = '';
}
function rotate_truth() {
        var i= Math.floor(Math.random()*truth.length);
        document.getElementById('dare_content').innerHTML = truth[i];
                document.getElementById('dice_roll').innerHTML = '';

}

</script>
<table cellpadding="5" cellspacing="3" align="center" style="background-color:#EDE685">
<tr>
<td colspan="2" align="center" width="500" style="font-family:Times New Roman;"><b>Truth or Dare?</b></td>
</tr>
<tr>
<td align="center"><input type="button" value="Truth" border="0" onclick="javascript:rotate_truth()" /></td>
<td align="center"><input type="button" value="Dare" border="0" onclick="javascript:rotate_dare()" /></td>
</tr>
<tr>
<td id="dare_content" colspan="2" width="500" align="center">Go ahead, ask for a truth ... I dare you!</td>
</tr>
</table>
again, you would have to add new entries manually, but once they are added you can easily open up the HTML page in any browser and grab random dares/truths/whatever you want
OneMoreTime is offline   Reply With Quote
Old 02-08-2011, 05:48 PM   #13
Leopard
Truth or Dare Enthusiast
 
Join Date: Oct 2009
Posts: 2,522
Default

Quote:
Originally Posted by OneMoreTime View Post
HTML Code:
<script type="text/javascript">
/**
Simply add the following to the code to make either new truths or dares 
dare.push("blah"); 
truth.push("blah"); 
**/
var dare = new Array();
        dare.push("dare 1");
        dare.push("dare 2");

var truth = new Array();
        truth.push('truth 1');
        truth.push('truth 2');

                
function rotate_dare()  {
        var i = Math.floor(Math.random()*dare.length);
    document.getElementById('dare_content').innerHTML = dare[i];
        document.getElementById('dice_roll').innerHTML = '';
}
function rotate_truth() {
        var i= Math.floor(Math.random()*truth.length);
        document.getElementById('dare_content').innerHTML = truth[i];
                document.getElementById('dice_roll').innerHTML = '';

}

</script>
<table cellpadding="5" cellspacing="3" align="center" style="background-color:#EDE685">
<tr>
<td colspan="2" align="center" width="500" style="font-family:Times New Roman;"><b>Truth or Dare?</b></td>
</tr>
<tr>
<td align="center"><input type="button" value="Truth" border="0" onclick="javascript:rotate_truth()" /></td>
<td align="center"><input type="button" value="Dare" border="0" onclick="javascript:rotate_dare()" /></td>
</tr>
<tr>
<td id="dare_content" colspan="2" width="500" align="center">Go ahead, ask for a truth ... I dare you!</td>
</tr>
</table>
again, you would have to add new entries manually, but once they are added you can easily open up the HTML page in any browser and grab random dares/truths/whatever you want
Thanks a lot, that's perfect

So I simply add dare.push('dare 3 is this') right? Are there any characters I can't use, " [ ] () etc?
Leopard is offline   Reply With Quote
Old 02-08-2011, 05:52 PM   #14
OneMoreTime
getDare Sweetheart
 
OneMoreTime's Avatar
 
Join Date: May 2010
Location: CA
Posts: 291
Default

Quote:
Originally Posted by Leopard View Post
Thanks a lot, that's perfect

So I simply add dare.push('dare 3 is this') right? Are there any characters I can't use, " [ ] () etc?
ya, just continue the lists. the only problem would be if you try to use quotes. like dare.push('blah blah don't blah'); would mess things up cause it reads the quote in dont as the closing of the first one. so just avoid " and ' when possible i guess

EDIT: also just realized i used " for one group and ' for the other lol. best to use the same one for both
OneMoreTime is offline   Reply With Quote
Old 02-08-2011, 05:53 PM   #15
Leopard
Truth or Dare Enthusiast
 
Join Date: Oct 2009
Posts: 2,522
Default

Quote:
Originally Posted by OneMoreTime View Post
ya, just continue the lists. the only problem would be if you try to use quotes. like dare.push('blah blah don't blah'); would mess things up cause it reads the quote in dont as the closing of the first one. so just avoid " and ' when possible i guess
Okay, thank you very much, that's exactly what I wanted
Leopard is offline   Reply With Quote
Reply

Advertisements
Kink Talk


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc. - Also check out Kink Talk!reptilelaborer