Soul Bound (Open world dungeon crawl)

This is the place to post your own creative works for other to play or give feedback on!
Forum rules
This forum is for posting and collaborating upon third party work. Please do not post request-threads, and avoid posting artwork that is not your own unless it is being used as a reference.

Re: Soul Bound (Open world dungeon crawl)

Postby kvier » Wed Apr 30, 2014 8:25 pm

So, I took your code from this post, threw it into a file ("Q.html"), opened firefox (28)'s debugger and opened the page in the browser. It shows me this:
Q.png
See over there on the right? Where it says "<exception>: Error" and "message: "Player is not defined"" ? That's all I'm doing. The green ■▶ cursor in the middle shows the line that contains the error, too.
If you hit the button in the upper left, it'll go on and tell you the next error (if one exists). After you have it running correctly, click on the "> Console" tab in the upper left, and the messages that your javascript is producing with "console.log()" will show up there.

Unfortunately, the debugger isn't also an editor, so you'll need to go back and forth between firefox's debugger and whatever your preferred editor is.
kvier
 
Joined: Mon Apr 23, 2012 7:46 pm

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Wed Apr 30, 2014 9:02 pm

kvier Wrote:So, I took your code from this post, threw it into a file ("Q.html"), opened firefox (28)'s debugger and opened the page in the browser. It shows me this:
Q.png
See over there on the right? Where it says "<exception>: Error" and "message: "Player is not defined"" ? That's all I'm doing. The green ■▶ cursor in the middle shows the line that contains the error, too.
If you hit the button in the upper left, it'll go on and tell you the next error (if one exists). After you have it running correctly, click on the "> Console" tab in the upper left, and the messages that your javascript is producing with "console.log()" will show up there.

Unfortunately, the debugger isn't also an editor, so you'll need to go back and forth between firefox's debugger and whatever your preferred editor is.

Ok, that's a slightly older set of code (I do have a new one, it's just not that different) and it's told me that all the errors are gone (or all the ones it can find). There still isn't any text outside of the debugger itself, but that's still a good step...
right?
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby kvier » Wed Apr 30, 2014 9:23 pm

Really? I took the code in that post, fixed the instance of "Player" (to "player"), and my console log shows this:
R.png
R.png (22.54 KiB) Viewed 2909 times
kvier
 
Joined: Mon Apr 23, 2012 7:46 pm

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Wed Apr 30, 2014 10:08 pm

Ok, I found another error while looking over it, and got this
Spoiler (click to show/hide):

"Goblin's Health is now 99" test%20game%200.00:55
"Goblin's Resitence is at 94" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 92" test%20game%200.00:55
"Goblin's Resitence is at 85" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 89" test%20game%200.00:55
"Goblin's Resitence is at 79" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 85" test%20game%200.00:55
"Goblin's Resitence is at 72" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 78" test%20game%200.00:55
"Goblin's Resitence is at 71" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 69" test%20game%200.00:55
"Goblin's Resitence is at 63" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 59" test%20game%200.00:55
"Goblin's Resitence is at 55" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 58" test%20game%200.00:55
"Goblin's Resitence is at 45" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 50" test%20game%200.00:55
"Goblin's Resitence is at 40" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 44" test%20game%200.00:55
"Goblin's Resitence is at 35" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 38" test%20game%200.00:55
"Goblin's Resitence is at 34" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 29" test%20game%200.00:55
"Goblin's Resitence is at 27" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 28" test%20game%200.00:55
"Goblin's Resitence is at 25" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 19" test%20game%200.00:55
"Goblin's Resitence is at 16" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 9" test%20game%200.00:55
"Goblin's Resitence is at 8" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now 8" test%20game%200.00:55
"Goblin's Resitence is at 4" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined" test%20game%200.00:65
"Goblin's Health is now -1" test%20game%200.00:55
"Goblin's Resitence is at -4" test%20game%200.00:57
"player's Health is now undefined" test%20game%200.00:63
"Player's Resitence is at undefined"

Now I just have to figure out what went wrong with the health (here's the code now):
Spoiler (click to show/hide):

<HTML>
<HEAD>
<SCRIPT>
var players = function(attack, health, attraction, lust){
this.health = health;
this.attack = attack;
this.attraction = attraction;
this.lust = lust;
};

var player = new players(25, 500, 25, 100);

var monsters = function(attack, health, attraction, lust){
this.health = health;
this.attack = attack;
this.attraction = attraction;
this.lust = lust;
};

var lesser_witch = new monsters(25, 250, 25, 100);
var goblin = new monsters(25, 100, 10, 100);
var lilith = new monsters(15, 500, 50, 100);

var names;

var randomnumber = Math.floor(Math.random(10)*10);

var selectedmonster;
if (randomnumber >= 0 && randomnumber < 3){
selectedmonster = lesser_witch;
names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6){
selectedmonster = goblin;
names = "Goblin";
}
else if (randomnumber > 6){
selectedmonster = lilith;
names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
while (battle == 1){

while (playerturn == 1){

selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.attack)*10);
console.log(names + "'s Health is now " + selectedmonster.health);
selectedmonster.lust = selectedmonster.lust - Math.ceil (Math.random(player.attraction)*10);
console.log(names + "'s Resitence is at " + selectedmonster.lust);
playerturn = 0;
monsterturn = 1;
}
while (monsterturn == 1){
player.health = players.health - Math.ceil(Math.random(selectedmonster.attack)*10);
console.log("player's Health is now " + players.health);
player.lust = players.lust - Math.ceil (Math.random(selectedmonster.attraction)*10);
console.log("Player's Resitence is at " + players.lust);
playerturn = 1;
monsterturn = 0;
}
if (selectedmonster.health < 0){
monsterdead = 1;
battle = 0;
}
if (selectedmonster.lust < 0){
monsterhorny = 1;
battle = 0;
}
if (players.health < 0){
playerdead = 1;
battle = 0;
}
if (players.lust < 0){
playerhorny = 1;
battle = 0;
}
}
</SCRIPT>
</HEAD>
</HTML>
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Wed Apr 30, 2014 10:22 pm

*Shouts NO at the top of his lungs*

I just had that indented!
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby Void Director » Thu May 01, 2014 3:21 am

kvier Wrote:So, I took your code from threw it into a file ("Q.html"), opened firefox (28)'s debugger and opened the page in the browser. It shows me this:
Q.png
See over there on the right? Where it says "<exception>: Error" and "message: "Player is not defined"" ? That's all I'm doing. The green ■▶ cursor in the middle shows the line that contains the error, too.
If you hit the button in the upper left, it'll go on and tell you the next error (if one exists). After you have it running correctly, click on the "> Console" tab in the upper left, and the messages that your javascript is producing with "console.log()" will show up there.

Unfortunately, the debugger isn't also an editor, so you'll need to go back and forth between firefox's debugger and whatever your preferred editor is.

You can do this in chrome as well. You can also set up a work-space with chrome so that it is able to edit files and persist them to the disk. I would recommend putting the script in a separate file and including it. This will allow a good text editor to give you much more help


Here is a very simple example structure

In index.html
Spoiler (click to show/hide):

Code: Select All Code
<HTML>
<HEAD>
    <script src="game.js"> </script>
</HEAD>
</HTML>


in game.js
Spoiler (click to show/hide):

Code: Select All Code
var players = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};

var player = new players(25, 500, 25, 100);

var monsters = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};

var lesser_witch = new monsters(25, 250, 25, 100);
var goblin = new monsters(25, 100, 10, 100);
var lilith = new monsters(15, 500, 50, 100);

var names;

var randomnumber = Math.floor(Math.random(10) * 10);

var selectedmonster;
if (randomnumber >= 0 && randomnumber < 3) {
    selectedmonster = lesser_witch;
    names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6) {
    selectedmonster = goblin;
    names = "Goblin";
}
else if (randomnumber > 6) {
    selectedmonster = lilith;
    names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
while (battle == 1) {
    while (playerturn == 1) {
        selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.attack) * 10);
        console.log(names + "'s Health is now " + selectedmonster.health);
        selectedmonster.lust = selectedmonster.lust - Math.ceil(Math.random(player.attraction) * 10);
        console.log(names + "'s Resitence is at " + selectedmonster.lust);
        playerturn = 0;
        monsterturn = 1;
    }
    while (monsterturn == 1) {
        player.health = player.health - Math.ceil(Math.random(selectedmonster.attack) * 10);
        console.log("player's Health is now " + player.health);
        player.lust = player.lust - Math.ceil(Math.random(selectedmonster.attraction) * 10);
        console.log("Player's Resitence is at " + player.lust);
        playerturn = 1;
        monsterturn = 0;
    }
    if (selectedmonster.health < 0) {
        monsterdead = 1;
        battle = 0;
    }
    if (selectedmonster.lust < 0) {
        monsterhorny = 1;
        battle = 0;
    }
    if (players.health < 0) {
        playerdead = 1;
        battle = 0;
    }
    if (players.lust < 0) {
        playerhorny = 1;
        battle = 0;
    }
}


The files game.js and index.html should be two files in the same folder. If you want to edit them in chrome simply open index.html in chrome then open the dev tools (f12). Switch to the sources tab and open the sidebar on the left side called sources. Right click and select Add Folder to Workspace. Navigate to the folder with Index.html and game.js and click ok. When chrome asks permission to edit the files say yes. From then on you can use chrome as a live editor while also saving the files to the disk.
Void Director
 
Joined: Thu Dec 19, 2013 4:18 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Thu May 01, 2014 12:14 pm

Void Director Wrote:
kvier Wrote:So, I took your code from threw it into a file ("Q.html"), opened firefox (28)'s debugger and opened the page in the browser. It shows me this:
Q.png
See over there on the right? Where it says "<exception>: Error" and "message: "Player is not defined"" ? That's all I'm doing. The green ■▶ cursor in the middle shows the line that contains the error, too.
If you hit the button in the upper left, it'll go on and tell you the next error (if one exists). After you have it running correctly, click on the "> Console" tab in the upper left, and the messages that your javascript is producing with "console.log()" will show up there.

Unfortunately, the debugger isn't also an editor, so you'll need to go back and forth between firefox's debugger and whatever your preferred editor is.

You can do this in chrome as well. You can also set up a work-space with chrome so that it is able to edit files and persist them to the disk. I would recommend putting the script in a separate file and including it. This will allow a good text editor to give you much more help


Here is a very simple example structure

In index.html
Spoiler (click to show/hide):

Code: Select All Code
<HTML>
<HEAD>
    <script src="game.js"> </script>
</HEAD>
</HTML>


in game.js
Spoiler (click to show/hide):

Code: Select All Code
var players = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};

var player = new players(25, 500, 25, 100);

var monsters = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};

var lesser_witch = new monsters(25, 250, 25, 100);
var goblin = new monsters(25, 100, 10, 100);
var lilith = new monsters(15, 500, 50, 100);

var names;

var randomnumber = Math.floor(Math.random(10) * 10);

var selectedmonster;
if (randomnumber >= 0 && randomnumber < 3) {
    selectedmonster = lesser_witch;
    names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6) {
    selectedmonster = goblin;
    names = "Goblin";
}
else if (randomnumber > 6) {
    selectedmonster = lilith;
    names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
while (battle == 1) {
    while (playerturn == 1) {
        selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.attack) * 10);
        console.log(names + "'s Health is now " + selectedmonster.health);
        selectedmonster.lust = selectedmonster.lust - Math.ceil(Math.random(player.attraction) * 10);
        console.log(names + "'s Resitence is at " + selectedmonster.lust);
        playerturn = 0;
        monsterturn = 1;
    }
    while (monsterturn == 1) {
        player.health = player.health - Math.ceil(Math.random(selectedmonster.attack) * 10);
        console.log("player's Health is now " + player.health);
        player.lust = player.lust - Math.ceil(Math.random(selectedmonster.attraction) * 10);
        console.log("Player's Resitence is at " + player.lust);
        playerturn = 1;
        monsterturn = 0;
    }
    if (selectedmonster.health < 0) {
        monsterdead = 1;
        battle = 0;
    }
    if (selectedmonster.lust < 0) {
        monsterhorny = 1;
        battle = 0;
    }
    if (players.health < 0) {
        playerdead = 1;
        battle = 0;
    }
    if (players.lust < 0) {
        playerhorny = 1;
        battle = 0;
    }
}


The files game.js and index.html should be two files in the same folder. If you want to edit them in chrome simply open index.html in chrome then open the dev tools (f12). Switch to the sources tab and open the sidebar on the left side called sources. Right click and select Add Folder to Workspace. Navigate to the folder with Index.html and game.js and click ok. When chrome asks permission to edit the files say yes. From then on you can use chrome as a live editor while also saving the files to the disk.

This is great and all, but, I don't use chrome, and am not 100% sure how to set up that file you're talking about.
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Thu May 01, 2014 6:23 pm

I was looking at your code and that repeating function for player and monster still bugged me. Here is a possible fix but I'm doing it on my phone.

Code: Select All Code
var Entity = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};
var player = Entity(25, 500, 25, 100);
var monster = Entity(25, 250, 25, 100);



It needs additional code to support more monsters but that will clean up your code.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Fri May 02, 2014 12:30 pm

Spoiler (click to show/hide):

Code: Select All Code
<HTML>
<HEAD>
<SCRIPT>
var Entity = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};
var player = Entity(25, 500, 25, 100);
var monster = Entity(25, 250, 25, 100);
var lesser_witch = Entity(25, 250, 25, 100);
var goblin = Entity(25, 100, 10, 100);
var lilith = Entity(15, 500, 50, 100);

var names;

var randomnumber = Math.floor(Math.random(10)*10);

var selectedentity;
if (randomnumber >= 0 && randomnumber < 3){
selectedmonster = lesser_witch;
names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6){
selectedmonster = goblin;
names = "Goblin";
}
else if (randomnumber > 6){
selectedmonster = lilith;
names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
while (battle == 1){

while (playerturn == 1){

selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.attack)*10);
console.log(names + "'s Health is now " + selectedmonster.health);
selectedmonster.lust = selectedmonster.lust - Math.ceil (Math.random(player.attraction)*10);
console.log(names + "'s Resitence is at " + selectedmonster.lust);
playerturn = 0;
monsterturn = 1;
}
while (monsterturn == 1){
player.health = players.health - Math.ceil(Math.random(selectedmonster.attack)*10);
console.log("player's Health is now " + players.health);
player.lust = players.lust - Math.ceil (Math.random(selectedmonster.attraction)*10);
console.log("Player's Resitence is at " + players.lust);
playerturn = 1;
monsterturn = 0;
}
if (selectedmonster.health < 0){
monsterdead = 1;
battle = 0;
}
if (selectedmonster.lust < 0){
monsterhorny = 1;
battle = 0;
}
if (players.health < 0){
playerdead = 1;
battle = 0;
}
if (players.lust < 0){
playerhorny = 1;
battle = 0;
}
}
</SCRIPT>
</HEAD>
</HTML>


I know I messed up somewhere (it keeps telling me selected monster is undefined) and I have a felling that it's all because I really don't know how to change the monster and entity around...
Should I just try a different battle engine?
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Fri May 02, 2014 1:06 pm

It's likely a mistake on my end or possibly you didn't edit your logic to support it. Give me a day and see if i can figure out what bug i introduced.

To answer your, i personally do not like the way you've programmed your code, but that's understandable since your learning and in fact it's good that your failing because now you're being forced to learn how to fix your problems or at least detect them.


I do request that you indent. Use tab, or 4 spaces extra on lines in your text editor when ever you do open brackets but do 4 spaces or tab less on lines after a close bracket. does this make sense? Look at the orginal code i edited of yours and you'll notice that i moved stuff to the right whenever it was in a if statement, forloop, or function. This is done to make it easier to read. I had to copy your code into my own text editor so i could read it.

Edit

I think i found your problem.
Your variable is named differently then what your trying to store into. I'm not seeing anywhere that uses selectedentity nor do i see you declaring selectedmonster.

Code: Select All Code
var selectedentity;

if (randomnumber >= 0 && randomnumber < 3){
   selectedmonster = lesser_witch;
   names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6){
   selectedmonster = goblin;
   names = "Goblin";
}
else if (randomnumber > 6){
   selectedmonster = lilith;
   names = "Lilith";
}

So when you do "var abc;" this is just a name. From what i remember of script based languages you can store anything in this which can get you into a lot of trouble. The computer doesn't care if the object is Entity, Monster, numbers or strings. What it cares about is that your telling it to get and store information from a valid variable name.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Sun May 04, 2014 3:40 pm

Ok, I'm just saying this so that I can try and get it. If I wanted to have the player fight a monster, then all I would have to do is to assign something like "var selectedmonster", and then have it randomly select one of the monsters available?
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Sun May 04, 2014 10:38 pm

that man Wrote:Ok, I'm just saying this so that I can try and get it. If I wanted to have the player fight a monster, then all I would have to do is to assign something like "var selectedmonster", and then have it randomly select one of the monsters available?

change "var selectedentity;" into "var selectedmonster" and i it should work.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Wed May 14, 2014 2:07 pm

Ok, it still won't read the code, but at least I managed to get some other, minor, changes to it
Spoiler (click to show/hide):

Code: Select All Code
<HTML>
<HEAD>
<SCRIPT>
var Entity = function (attack, health, attraction, lust) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};
var player = Entity(25, 500, 25, 0);
var lesser_witch = selectedmonster(25, 250, 25, 0);
var goblin = selectedmonster(25, 100, 10, 0);
var lilith = selectedmonster(15, 500, 50, 0);

var names;

var randomnumber = Math.floor(Math.random(10)*10);

var selectedmonster;
if (randomnumber >= 0 && randomnumber < 3){
   selectedmonster = lesser_witch;
   names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6){
   selectedmonster = goblin;
   names = "Goblin";
}
else if (randomnumber > 6){
   selectedmonster = lilith;
   names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
   while (battle == 1){

while (playerturn == 1){

   selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.attack)*10);
      console.log(names + "'s Health is now " + selectedmonster.health);
   selectedmonster.lust = selectedmonster.lust + Math.ceil (Math.random(player.attraction)*10);
      console.log(names + "'s Resitence is at " + selectedmonster.lust);
playerturn = 0;
monsterturn = 1;
}

while (monsterturn == 1){
   player.health = players.health - Math.ceil(Math.random(selectedmonster.attack)*10);
      console.log("player's Health is now " + players.health);
   player.lust = players.lust + Math.ceil (Math.random(selectedmonster.attraction)*10);
      console.log("Player's Resitence is at " + players.lust);
playerturn = 1;
monsterturn = 0;
}

if (selectedmonster.health < 0){
   monsterdead = 1;
   battle = 0;
}

if (selectedmonster.lust > 100){
   monsterhorny = 1;
   battle = 0;

}

if (players.health < 0){
   playerdead = 1;
   battle = 0;

}

if (players.lust > 100){
   playerhorny = 1;
   battle = 0;

}

}
</SCRIPT>
</HEAD>
</HTML>

Also, I just realized that this code is not very individual, unique, dialogue friendly, is it?
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Wed May 14, 2014 3:53 pm

it's indented.... i could kiss you but i wont. :P

okay if i have time today i'll see if i can provide a tested and working versions of my edit.
EDIT
any reason why you give an extra indent to lines starting with console.log? however i'm quite happy your code is readable now.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Wed May 14, 2014 7:50 pm

None really.
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Wed May 14, 2014 8:27 pm

Okay i'm getting this error with your code unedited
(should be the latest you gave)
[12:25:29.182] TypeError: selectedmonster is not a function @ file:///H:/debug.html:11
[12:25:29.184] The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. @ file:///H:/debug.html


debug is my file name. Wasn't sure what to call it.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Thu May 15, 2014 3:47 am

Yeah, that looks like the one that I'm getting too.
Any idea what's causing it this time, because, I keep messing around and ending up with the same message.
edit:
Spoiler (click to show/hide):

just what you've always wanted:
More code, with a very major change to it!
Code: Select All Code
<HTML>
<HEAD>
<SCRIPT>
var Entity = function (health, lust, strength, resilience, willpower, intelligence, libido, speed) {
    this.health = health;
    this.attack = attack;
    this.attraction = attraction;
    this.lust = lust;
};
var player = Entity(500, 0, 10, 10, 10, 10, 10, 10);
var lesser_witch = selectedmonster(250, 0, 5, 5, 10, 15, 15, 10);
var goblin = selectedmonster(100, 0, 15, 15, 5, 5, 15, 5);
var lilith = selectedmonster(500, 0, 25, 25, 25, 25, 25, 25);

var names;

var randomnumber = Math.floor(Math.random(10)*10);

var selectedmonster;
if (randomnumber >= 0 && randomnumber < 3){
   selectedmonster = lesser_witch;
   names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6){
   selectedmonster = goblin;
   names = "Goblin";
}
else if (randomnumber > 6){
   selectedmonster = lilith;
   names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
   while (battle == 1){

while (playerturn == 1){

   selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.power + player.speed - selectedmonster.resilience - selectedmonster.speed)*10);
      console.log(names + "'s Health is now " + selectedmonster.health);
   selectedmonster.lust = selectedmonster.lust + Math.ceil (Math.random(player.libido + player.willpower - selectedmonster.willpower - selectedmonster.intelligence)*10);
      console.log(names + "'s Resitence is at " + selectedmonster.lust);
playerturn = 0;
monsterturn = 1;
}

while (monsterturn == 1){
   player.health = players.health - Math.ceil(Math.random(selectedmonster.power + selectedmonster.speed - player.resilience - player.speed)*10);
      console.log("player's Health is now " + players.health);
   player.lust = players.lust + Math.ceil (Math.random(selectedmonster.libido + selectedmonster.willpower - player.willpower - player.intelligence)*10);
      console.log("Player's Resitence is at " + players.lust);
playerturn = 1;
monsterturn = 0;
}

if (selectedmonster.health < 0){
   monsterdead = 1;
   battle = 0;
}

if (selectedmonster.lust > 100){
   monsterhorny = 1;
   battle = 0;

}

if (players.health < 0){
   playerdead = 1;
   battle = 0;

}

if (players.lust > 100){
   playerhorny = 1;
   battle = 0;

}

}
</SCRIPT>
</HEAD>
</HTML>

edit:
gah, nothing to stop the code from doing the wrong negative/positive values
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Tue May 20, 2014 5:20 am

Well, I can't figure out how exactly to fix the programing, so I decided to work on some of the other aspects of the game. Here are some more concept arts (yes, they are paint again) and these are near the border of what I'm comfortable drawing. So, let me know if these designs work, and have a fun day:
Attachments
unknown boss proto 1.png
I...I really don't know...This design was just sketched out on some paper near my bed when I woke up, so I finished it here.
unknown boss proto 1.png (6.66 KiB) Viewed 2413 times
sewer slime proto 1.png
(sewer) slime proto
sewer slime proto 1.png (3.95 KiB) Viewed 2413 times
stalker proto1.png
Stalker (female) prototype
stalker proto1.png (3.58 KiB) Viewed 2413 times
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

Re: Soul Bound (Open world dungeon crawl)

Postby BlueLight » Tue May 20, 2014 5:54 am

So your treating the variable like a function (or is it the other way around?) which is the problem.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Soul Bound (Open world dungeon crawl)

Postby that man » Tue May 20, 2014 2:07 pm

I think what's going on is that I want to treat selectedmonster as a variable, but I think it's where the variable is set up that's throwing it off...hold on, I'm going to try something after posting this, and will edit it with the results.

EDIT
Well, not only did I clean up some other errors in the system, but it now recognizes selectedmonster as a variable. Unfortunately, it still doesn't recognize said monsters, which is a slight improvement over before, and I still need to figure out how to keep hits from going below 0, and maybe having a hit/miss system for normal combat. Those things come later, and for now, here's the code I have

Spoiler (click to show/hide):

Not entirely sure what's wrong, but my best guess is that I would have to define the monsters as "Entity", then have the actual data of their name stored elsewhere. I would test this before posting, but I have physical tasks I must accomplish.
EDIT
No, that just made things worse...not only will it not line up the individual monsters, but now the player is undefined. I'm not updating the code to reflect this (since I'm not going to keep it), but, just replace the monster's base name after EVERY var selectedmonster with "Entity", and you'll see what I mean.
Code: Select All Code
<HTML>
<HEAD>
<SCRIPT>
var Entity = function (health, lust, strength, resilience, willpower, intelligence, libido, speed) {
    this.health = health;
    this.strength = strength;
    this.lust = lust;
   this.resilience = resilience;
   this.willpower = willpower;
   this.intelligence = intelligence;
   this.libido = libido;
   this.speed = speed;
};
var player = Entity(500, 0, 10, 10, 10, 10, 10, 10);
var selectedmonster = lesser_witch(250, 0, 5, 5, 10, 15, 15, 10);
var selectedmonster = goblin(100, 0, 15, 15, 5, 5, 15, 5);
var selectedmonster = lilith(500, 0, 25, 25, 25, 25, 25, 25);

var names;

var randomnumber = Math.floor(Math.random(10)*10);

var selectedmonster;
if (randomnumber >= 0 && randomnumber < 3){
   selectedmonster = lesser_witch;
   names = "Lesser Witch";
}
else if (randomnumber > 3 && randomnumber < 6){
   selectedmonster = goblin;
   names = "Goblin";
}
else if (randomnumber > 6){
   selectedmonster = lilith;
   names = "Lilith";
}

var battle = 1;
var monsterdead = 0;
var playerdead = 0;
var monsterhorny = 0;
var playerhorny = 0;

var playerturn = 1;
var monsterturn = 0;
   while (battle == 1){

while (playerturn == 1){

   selectedmonster.health = selectedmonster.health - Math.ceil(Math.random(player.power - selectedmonster.resilience)*10);
      console.log(names + "'s Health is now " + selectedmonster.health);
   selectedmonster.lust = selectedmonster.lust + Math.ceil (Math.random(player.libido + player.willpower - selectedmonster.willpower - selectedmonster.intelligence)*10);
      console.log(names + "'s Resitence is at " + selectedmonster.lust);
playerturn = 0;
monsterturn = 1;
}

while (monsterturn == 1){
   player.health = players.health - Math.ceil(Math.random(selectedmonster.power + selectedmonster.speed - player.resilience - player.speed)*10);
      console.log("player's Health is now " + players.health);
   player.lust = players.lust + Math.ceil (Math.random(selectedmonster.libido + selectedmonster.willpower - player.willpower - player.intelligence)*10);
      console.log("Player's Resitence is at " + players.lust);
playerturn = 1;
monsterturn = 0;
}

if (selectedmonster.health < 0){
   monsterdead = 1;
   battle = 0;
}

if (selectedmonster.lust > 99){
   monsterhorny = 1;
   battle = 0;

}

if (players.health < 0){
   playerdead = 1;
   battle = 0;

}

if (players.lust > 99){
   playerhorny = 1;
   battle = 0;

}

}
</SCRIPT>
</HEAD>
</HTML>


Final note:
Am I bad at character designs? If I am, just let me know, and I'll try something else for them.
that man
 
Joined: Sat Jul 28, 2012 5:07 pm

PreviousNext

Return to Creative Corner



Who is online

Users browsing this forum: No registered users