Quantcast

Jump to content


Photo

jcg is learning js


  • Please log in to reply
20 replies to this topic

#1 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 14 July 2010 - 08:57 PM

Putting js in her language so its easy for her to understand:
var price_of_whore = 15;
var whores_want = prompt('How many whores do you want?\nWhores cost $' + price_of_whore + ' each.');
if (!whores_want || isNaN(whores_want)) {
	alert('Prostitution canceled')
} else {
	var verify = confirm('Are you sure you want to purchase ' + whores_want + ' whores?');
	if (verify == true) {
		alert('That will cost $' + (whores_want * price_of_whore) + '.');
	}
	else {
		alert('Prostitution canceled');
	}
}

Simplified using for understanding. ex: using verified == true over if (confirm('blah')){}else{}

#2 Shawn

Shawn
  • 4 posts

Posted 14 July 2010 - 09:27 PM

Lolwut is this

#3 pabs123

pabs123
  • 498 posts

Posted 14 July 2010 - 09:52 PM

Simplified using for understanding. ex: using verified == true over if (confirm('blah')){}else{}


lol when i was reading it i thought " i'm gonna be a smartass and write 'you could have simplified verified==truue...' oh shit he outsmarted me"

#4 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 14 July 2010 - 11:23 PM

Haha yeah im dumming things as much as possible for jcg.

#5 Guest_jcrgirl_*

Guest_jcrgirl_*

Posted 15 July 2010 - 01:57 AM

HAHAHAHAA I LOVE YOU NOIT really and truly I do!!!! Posted Image
I see the light! Im gonna play around with this while everyone is sleeping lol Posted Image


edit;

woah i just realized you made that whole prompt box a var and used the output of that var to multiply it with how much each whore costs
that is quite clever sir




alert("Hello");
var name = prompt("What is your name?");
alert(name + " is a pretty name.");
var live = prompt("Mind telling me where you live, " + name + "?");
var answer = confirm (live + "? Oh, that is pretty cool!\n I'm from Russia, and I'm here to sell you a mail order bride!\n Are you interested?");
if (answer)
alert("Congrats! You are the proud owner of your very own russian bride!");
else
alert ("Oh well! No hot russian beauties for you!");


When I tried to add more stuff to the if/else it gave me syntax errors ;___; idk what Im doing wrong :(




nevermind ..... i made it do what i want... i think i had those squiggly brackets wrong

alert("Hello");

var bride_price = 100;
var tax = .085;
var name = prompt("What is your name?");
alert(name + " is a pretty name.");
var live = prompt("Mind telling me your address, " + name + "?");


var answer = confirm (live + "? Oh, that is pretty cool!\n I'm from Russia, and I'm here to sell you a mail order bride!\n Are you interested?");
if (answer == true) {

var bride_number = prompt("How many Russian ladies would you like to buy?");
if (!bride_number || isNaN(bride_number)) {
        alert('Transaction Cancelled')

}
else {
alert("They cost: $" + bride_price +" each.")
alert("Total $" + (bride_number * bride_price) + ".");
alert("Billing Information:\nName: " + name + "\nAddress: " + live + "\nBrides Purchased: " + bride_number + "\nTax: $" + (tax * bride_number * bride_price) + "\nGrand Total: $" + (tax * bride_number * bride_price + bride_price * bride_number) + "\n\nThank You!\nHave a nice day!");                                                                                                                                                                                                                                                                                                


}
}


only problem now is the prompt box has a cancel option and it will go through no matter what lols x.x

Edited by jcrgirl, 15 July 2010 - 04:19 AM.


#6 pabs123

pabs123
  • 498 posts

Posted 15 July 2010 - 09:32 AM

nevermind ..... i made it do what i want... i think i had those squiggly brackets wrong


ahh those squiggly brackets mean everything ;)

#7 Rambo

Rambo
  • 833 posts

Posted 15 July 2010 - 10:14 AM

Once she handles JS she can do Java :D

#8 aweroij

aweroij
  • 44 posts

Posted 15 July 2010 - 10:42 AM

Once she handles JS she can do Java :D


Uh. No? O_o

I'll quote *gasp* Wikipedia.

JavaScript and the Java programming language both use syntaxes influenced by that of C syntax, and JavaScript copies many Java names and naming conventions; but the two languages are otherwise unrelated and have very different semantics.



#9 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 15 July 2010 - 10:50 AM

You know I love you soooooooo much more!!! Remebmer the whole thing of after JC pasess on and in a flash and yeah.

Java is close but you need learn objects in js to be able to easily understand java.
Dont steal jcg from my web site. She might be able to help us on that end :)

jcg to detect if a prompt is canceld you do this:

var myPro = prompt('Enter value:','here');
if (!myPro){
alert('you pressed cancel, clicked x, or entered blank');
} else{
alert('you typed: '+myPro);
}


#10 Guest_jcrgirl_*

Guest_jcrgirl_*

Posted 15 July 2010 - 01:26 PM

You know I love you soooooooo much more!!! Remebmer the whole thing of after JC pasess on and in a flash and yeah.

Java is close but you need learn objects in js to be able to easily understand java.
Dont steal jcg from my web site. She might be able to help us on that end :)

jcg to detect if a prompt is canceld you do this:



alert("Hello");

var bride_price = 100;
var tax = .085;
var name = prompt("What is your name?","Name Here");

if (!name){
alert("I never liked you anyway. Go die.");
} else{
alert(name + " is a pretty name.");
}
var live = prompt("Mind telling me your address, " + name + "?","Address Here");
if (!live){
alert("Oh well, I guess you are homeless.");
} else{
alert("Locating.... please wait.");
}

var answer = confirm (" " + live + "? Oh, that is pretty cool!\n I'm from Russia, and I'm here to sell you a mail order bride!\n Are you interested?");
if (answer == true) {

var bride_number = prompt("How many Russian ladies would you like to buy?");
if (!bride_number || isNaN(bride_number)) {
        alert('Transaction Cancelled')

}
else {
alert("They cost: $" + bride_price +" each.")
alert("Total $" + (bride_number * bride_price) + ".");
alert("Billing Information:\nName: " + name + "\nAddress: " + live + "\nBrides Purchased: " + bride_number + "\nTax: $" + (Math.round(tax * bride_number * bride_price)) + "\nGrand Total: $" + (Math.round(tax * bride_number * bride_price + bride_price * bride_number)) + "\n\nThank You!\nHave a nice day!");                                                                                                                                                                                                                                                                                                


}

}



I added those in... but it still inputs "Nil" into the next prompt if they press cancel haha! I added Math.round so it rounds the tax on the russian brides XD

#11 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 15 July 2010 - 04:05 PM

Wow that's really really cool jcg!! I see you got tax in there too haha

#12 pabs123

pabs123
  • 498 posts

Posted 15 July 2010 - 06:59 PM

Uh. No? O_o


they're similar but you don't have to know one to know the other... im pretty fluent in java and i don't know javascript but looking at this code i know exactly what they're doing... regardless it's cute watching someone learn right here in front of my eyes :) hehe

#13 Guest_jcrgirl_*

Guest_jcrgirl_*

Posted 15 July 2010 - 09:19 PM

Idk what to do next
Noit tell me what I should do and Ill try by myself lol

#14 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 16 July 2010 - 12:47 AM

Ok let me come with something.

Ok here it is:


I call it: Welcome to JCGs whore house. Frickin she wouldnt give me her pic but recommended and gave me all these other names and pictures.
<html>
<head>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.6/prototype.js'></script>

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8/scriptaculous.js?load=effects,
dragdrop,builder'></script>

<script>
var onhand = 100;
var balance = 500;
var zindex = 1;

window.onload = startPage;

var whore_d = {}; //ignore
var whores_available = ['JC', 'Annabeth', 'joanna', 'Georgina', 'vin', 'Noit', 'Rambo', 'zack'];
var whore_pic = {
        'JC': 'http://neocodex.us/forum/uploads/profile/photo-thumb-25200.jpg',
        'Annabeth': 'http://neocodex.us/forum/uploads/profile/photo-thumb-27702.jpg',
        'joanna': 'http://neocodex.us/forum/uploads/profile/photo-thumb-27956.jpg',
        'Georgina': 'http://neocodex.us/forum/uploads/profile/photo-thumb-26851.jpg',
        'vin': 'http://neocodex.us/forum/uploads/profile/photo-thumb-28838.jpg',
        zack: 'http://neocodex.us/forum/uploads/profile/photo-thumb-29065.jpg',
        Rambo: 'http://neocodex.us/forum/uploads/profile/photo-thumb-25757.jpg',
        Noit: 'http://neocodex.us/forum/uploads/profile/photo-thumb-12.jpg'
}
whore_used_says = ['Ooooo baby...','*hyperventilates*','More baby more!!!!','In the ass baby in the ass!!!'];

function startPage() {
        $('cash').innerHTML = '$' + onhand;
        $('balance').innerHTML = '$' + balance;
        alert('Whoring commence...');


        var dropFunc = function (dragged, dropped, event) {
                whore_d[dragged.id].options.revert = false;
                alert(dragged.id + ' says:\n\nWee baby let\'s play!! Poke me in my special parts!!');
        }
        //Droppables.add('jcg_house',{onDrop:dropFunc});

Effect.Shake = function (element) {
    element = $(element);
    var options = Object.extend({distance: 20, duration: 0.5}, arguments[1] || {});
    var distance = parseFloat(options.distance);
    var split = parseFloat(options.duration) / 10;
    var oldStyle = {top: element.getStyle("top"), left: element.getStyle("left")};
    return new (Effect.Move)(element, {x: distance, y: 0, duration: split, afterFinishInternal: function (effect) {new (Effect.Move)(effect.element, {x: - distance * 2, y: 0, duration: split * 2, afterFinishInternal: function (effect) {new (Effect.Move)(effect.element, {x: distance * 2, y: 0, duration: split * 2, afterFinishInternal: function (effect) {new (Effect.Move)(effect.element, {x: - distance * 2, y: 0, duration: split * 2, afterFinishInternal: function (effect) {new (Effect.Move)(effect.element, {x: distance * 2, y: 0, duration: split * 2, afterFinishInternal: function (effect) {new (Effect.Move)(effect.element, {x: - distance, y: 0, duration: split, afterFinishInternal: function (effect) {effect.element.undoPositioned().setStyle(oldStyle);if(typeof(options.afterFinish)=='function'){options.afterFinish()}}});}});}});}});}});}});
}


}


function hireWhore() {

        if (whores_available.length == 0) {
                alert('Sorry, all our whores are currently in use. =(');
                return;
        }
        var whore_cost = 50;
        if (onhand < whore_cost) {
                alert('Get out! Each whore costs $' + whore_cost + '!');
                return;
        }


        var whore = document.createElement('img');
        whore.setStyle({
                'display': 'none',
                'cursor': 'pointer',
                position: 'absolute',
                'z-index': zindex
        });
        zindex++;

        var whore_number = Math.floor(Math.random() * whores_available.length);
        whore.id = whores_available[whore_number];
        whore.src = whore_pic[whores_available[whore_number]];

        whores_available.splice(whore_number, 1); //remove whore from available list
        //ignore this
        var revFunc = function (element, top_offset, left_offset) {
                alert(element.id + ' says:\n\n:\'(!!! Take me home take me home!!!!');
                var dur = Math.sqrt(Math.abs(top_offset ^ 2) + Math.abs(left_offset ^ 2)) * 0.02;
                new Effect.Move(element, {
                        x: -left_offset,
                        y: -top_offset,
                        duration: dur,
                        queue: {
                                scope: '_draggable',
                                position: 'end'
                        }
                });

        }
        //end ignore
        var endFunc = function (elId) {
                if (Position.within($('jcg_house'), $(elId).cumulativeOffset()[0], $(elId).cumulativeOffset()[1])) {
                        whore_d[elId].options.revert = false;
                        whore_d[elId].destroy();
                        $(elId).observe('mousedown', function () {
                                Effect.Shake(elId,{afterFinish:function(){alert(elId + ' says:\n\n'+whore_used_says[Math.floor(Math.random() * whore_used_says.length)])}   });
                        });
                        alert(elId + ' says:\n\nWee baby let\'s play!! Poke me in my special parts!!');
                }

        }

        var dragOptions = {
                starteffect: null,
                endeffect: null,
                revert: true,
                reverteffect: revFunc,
                onEnd: function () {
                        endFunc(whore.id)
                }
        }

        whore_d[whore.id] = new Draggable(whore, dragOptions);

        $('whore_house').appendChild(whore);

        whore.appear();

        onhand = onhand - whore_cost;
        $('cash').innerHTML = '$' + onhand;
        $('cash').highlight();

}

function playWithWhore(whoreTarget) {
        whoreTarget.shake();
}

function deposit() {
        var amt = prompt('Deposit how much?', '');
        if (!amt || amt <= 0) {
                alert('Transaction cancelled');
                return;
        }

        if (isNaN(amt)) {
                alert('Are you stupid? Thats not a number');
                return;
        }

        amt = parseFloat(amt);

        if (amt > onhand) {
                alert('You don\'t have that much money');
                return;
        }

        balance = balance + amt;
        onhand = onhand - amt;
        $('cash').innerHTML = '$' + onhand;
        $('balance').innerHTML = '$' + balance;
        $('cash').highlight();
        $('balance').highlight();

}


function withdraw(quick) {

        if (quick >= 1) {
                var amt = quick;
        } else {
                var amt = prompt('Withdraw how much?', '');
        }
        if (!amt || amt <= 0) {
                alert('Transaction cancelled');
                return;
        }

        if (isNaN(amt)) {
                alert('Are you stupid? That\'s not a number');
                return;
        }

        amt = parseFloat(amt);

        if (amt > balance) {
                alert('You don\'t have that much money');
                return;
        }

        balance = balance - amt;
        onhand = onhand + amt;
        $('cash').innerHTML = '$' + onhand;
        $('balance').innerHTML = '$' + balance;
        $('cash').highlight();
        $('balance').highlight();

}
</script>

</head>
<body>

<span id="whore_house" style="border:1px solid steelblue; height:200px; width:200px; display:inline-block;">Welcome to JCG's whore house<br><a href="#" onclick="hireWhore()">Hire Whore</a></span>

<span id="jcg_house" style="border:1px solid steelblue; height:200px; width:200px;display:inline-block;">Welcome to JCG's house<br><small>Click on the whore you would like to bang</small></span>

<br><br>
<span id="bank" style="border:1px solid black; width:200px; height:200px; display:inline-block;">
Bank<br>
On Hand:<span id="cash">a</span><br>
Balance:<span id="balance">a</span><br>
<a href="#" onclick="withdraw()">Withdraw</a><br>
<a href="#" onclick="withdraw(50)">Quick Withdraw</a><br>
<a href="#" onclick="deposit()">Deposit</a><br>
</span>

</body>
</html>


#15 iargue

iargue
  • 10048 posts


Users Awards

Posted 16 July 2010 - 12:54 AM

Ok let me come with something.

Ok here it is:


I call it: Welcome to JCGs whore house. Frickin she wouldnt give me her pic but recommended and gave me all these other names and pictures.



Noit. You make me so hot....

#16 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 16 July 2010 - 12:58 AM

Hahahaha. I love you argue!

what happend to our humping smilie? O_o

#17 iargue

iargue
  • 10048 posts


Users Awards

Posted 16 July 2010 - 01:03 AM

Damn it. You had originally posted just HAHAHAHA, so I was just going to unapproved your post :p.

But then you added that you loved me, so I let things slide.

:console: Does that work?

#18 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 16 July 2010 - 01:11 AM

Rofl you jerk!
Hahaha thats not humping one sec let me find it :p

Here's one:
Posted Image Let me find the other :p

Edit: thats all i can find :(

#19 Dan

Dan
  • Resident Know-It-All

  • 6382 posts


Users Awards

Posted 16 July 2010 - 05:37 AM

I'm upset I wasn't listed as a whore.

And obligatory mention: JS != Java != C

#20 Guest_jcrgirl_*

Guest_jcrgirl_*

Posted 16 July 2010 - 07:53 AM

omg that thing is frickin awesome XD
I have work now tho ill play with it later

#21 Noitidart

Noitidart
  • Neocodex Co-Founder

  • 23214 posts


Users Awards

Posted 16 July 2010 - 03:01 PM

Sorry dan :'(
I was coding I didn't have time to pick people and find their images. I went with whatever jg was able to get.

Edit:
Added a says after the whore is fuked. Updated the code above.

jcg: your project: make it so if you right click on a whore that you have brought home it sends them back to the whore house and they can be hired later. Use Effect.Move to send it back to the whore house and then make it fade away and restore it to the array of whores_available. :D


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users