Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jubal

Pages: 1 ... 1835 1836 [1837] 1838 1839 ... 2099
27541
Good to see you here!  :)

Okay...

It makes a lot more sense for me to advise you than code it for you, since a) I'm hella short on time and b) then you'll know how for next time.

If you've never done functions before, the code is as follows.

function function_name () {}

Inputs into the function are in the round brackets, those create a kind of local variable for use within the function, which you have to put in when you call the function. The curly brackets are what the function does. The function keyword declares that this is a new function.

So for a button to call a function, have the button with onclick="function_name();" as a property. If you have any input variables, they need to go in the round brackets, for example if you're inputting a number it should be function_name(3); or whatever. However, in your case I think you probably want to get your numerical input from a text box, and you can "grab" that via the Document Object Model (you give the textbox a name="boxname" attribute, then
inputnum = encodeURIComponent(document.getElementById("boxname").value);
Will make a variable with your value in it. It's not all that neat, but it works. Another handy tip is that when you're grabbing numbers, multiply them by one before doing anything else; this checks/forces Javascript to see it as a number variable, since there's not actually any differentiation when creating the variables.

I'm assuming you know the HTML side of this, but correct me if I'm wrong. THhe above should let you get started; your start button needs to generate a random number and store it in a global variable (in other words, you need to create the storage variable outside your function). Then make a textbox, give it a name, make a second button that grabs your value from the textbox, tests if it's equal to the first stored value, then if it is adds to a "wins" variable and possibly also makes a little popup box to tell them that. Once you've got that sorted

Other useful functions:
Math.random() creates a random number between 0 and 1
+ - * / for add, take, times, divide
Math.round(a number) rounds it up to the nearest whole
Math.floor(a number) rounds it down to the nearest whole

You can nest functions, so Math.round(Math.random) will always give a value of 1. Math.round(Math.random()*10) will give a random number from 1 to 10, and so on.

Hope that helps as a starting point.  :)

27542
Forum Games - The Beer Cellar! / Re: PANTS!
« on: November 08, 2011, 07:02:07 PM »
"These are pants. I wear pants now. Pants are cool."

27543
Forum Games - The Beer Cellar! / Re: Word Association
« on: November 07, 2011, 07:02:31 PM »
Vessel

27544
Forum Games - The Beer Cellar! / Re: Word Association
« on: November 06, 2011, 06:54:49 PM »
Flat cauldron

27545
Since it's "start with the last letter of the previous word" I'll carry on from CG's.

Agathism - Noun
The doctrine or philosophical idea that all things tend, by nature, towards good.

27546
Warhammer; Total War / Re: Progress Log
« on: November 06, 2011, 02:55:51 PM »
Suddenly that land of inexplicable CTDs has been entered.  :(

27547
Forum Games - The Beer Cellar! / Re: Word Association
« on: November 06, 2011, 01:17:58 PM »
Sky

27548
The Exilian Channel & Twitch / Re: JuVlog: The Thread
« on: November 06, 2011, 12:16:40 PM »
Pangolins and Human Rights, up to watch now!  :)

27549
Discussion and Debate - The Philosopher's Plaza / Human Rights
« on: November 06, 2011, 12:14:01 PM »
Okay, I want to open a debate on Human Rights, in relation to my latest Vlogpost.
http://www.youtube.com/watch?v=OxXsMgijO48

Specifically, does anyone actually disagree with the current list? If so, why? And should anything be added or removed?

List is here:
http://www.direct.gov.uk/en/governmentcitizensandrights/yourrightsandresponsibilities/dg_4002951

Quote
Your human rights are:
the right to life
freedom from torture and degrading treatment
freedom from slavery and forced labour
the right to liberty
the right to a fair trial
the right not to be punished for something that wasn't a crime when you did it
the right to respect for private and family life
freedom of thought, conscience and religion, and freedom to express your beliefs
freedom of expression
freedom of assembly and association
the right to marry and to start a family
the right not to be discriminated against in respect of these rights and freedoms
the right to peaceful enjoyment of your property
the right to an education
the right to participate in free elections
the right not to be subjected to the death penalty

So... what's wrong with those?

27550
Forum Games - The Beer Cellar! / Re: Word Association
« on: November 05, 2011, 11:00:14 PM »
Iorek Byrnison

27551
Forum Games - The Beer Cellar! / Re: Word Association
« on: November 05, 2011, 07:20:08 PM »
Penguins  :)

27552
Gyromancy - Noun
A form of divination by the means of walking around in a circle continually until the walker falls from dizziness: the divination is read from the place in the circle and the manner in which the walker falls.

This sounds rather amusing to try. Particularly if the walker in question was inebriated beforehand...  :P

27553
Okay, this is the intellectual equivalent of a forum game. Essentially someone posts an unusual, little-known or interesting word, the next poster has to find another unusual or interesting word starting with the last letter of the previous one.

Here goes:

Croodle - Verb
Meaning to cower, crouch, draw together for warmth or cling close to someone e.g. "We huddled under the bridge, croodling together helplessly as we struggled for warmth in the bitter weather."

Next person gets E.  :)

27554
General Chatter - The Boozer / Re: Funny Picture Thread
« on: November 04, 2011, 06:09:49 PM »
Can't remember if we've had either of these:


Because everyone loves Chemistry.

Annnd... why you should never hit a cat.

27555
General Chatter - The Boozer / Re: Workshop Booze Up III - GO GO GO!
« on: November 04, 2011, 05:46:05 PM »
Halfway between pain and Exeter. Interesting...

Pages: 1 ... 1835 1836 [1837] 1838 1839 ... 2099