Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ Code compiling
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Fri Jan 09, 2009 5:33 pm    Post subject: Reply with quote

oops

The pussy is right.

Code:

double getCombat(double att, double str, double def, double hp, double mage, double range, double pray) {
    string combat_class;
   
    double cmblvl = (0.32707 * att) + (0.249 * def) + (0.324 * str) + (0.25 * hp) + (0.124 * pray);
    double rangelvl = (0.487 * range) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
    double magelvl = (0.487 * mage) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
   
    if ((cmblvl > magelvl) && (cmblvl > rangelvl)) {
        combat_class = "Warrior";
    }
    else if ((rangelvl > magelvl) && (rangelvl > cmblvl)) {
        combat_class = "Ranger";
        cmblvl = rangelvl;
    }
    else if ((magelvl > cmblvl) && (magelvl > rangelvl)) {
        combat_class = "Mage";
        cmblvl = magelvl;
    }
    else {
        combat_class = "Warrior";
    }
   
    return(cmblvl);
}

int main(){

}
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Fri Jan 09, 2009 5:41 pm    Post subject: Reply with quote

yes and inside int main{ do something like,

Code:

 int main()
{
    double CombatLevel = getCombat(99, 99, 99, 99, 99, 99, 99);
   
    cout << CombatLevel;
    cin.get();
    return 0;


   
}
Back to top
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Fri Jan 09, 2009 8:20 pm    Post subject: Reply with quote

Okay, I am about to try editing the .cpp file again according to you. By the way I just installed Visual C++ 08 Express and I will that if all else fails.

Edit: Failed Rolling Eyes

Here is how the code looked like.

Code:
#include <iostream>
#include <string>
#include "combatclass.cpp"
using namespace std;

void err (float eprob); 

int main()




double getCombat(double att, double str, double def, double hp, double mage, double range, double pray) {
    string combat_class;
   
    double cmblvl = (0.32707 * att) + (0.249 * def) + (0.324 * str) + (0.25 * hp) + (0.124 * pray);
    double rangelvl = (0.487 * range) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
    double magelvl = (0.487 * mage) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
   
    if ((cmblvl > magelvl) && (cmblvl > rangelvl)) {
        combat_class = "Warrior";
    }
    else if ((rangelvl > magelvl) && (rangelvl > cmblvl)) {
        combat_class = "Ranger";
        cmblvl = rangelvl;
    }
    else if ((magelvl > cmblvl) && (magelvl > rangelvl)) {
        combat_class = "Mage";
        cmblvl = magelvl;
    }
    else {
        combat_class = "Warrior";
    }
   
    return(cmblvl);

   int main()
   {      
      double CombatLevel = getCombat(99, 99, 99, 99, 99, 99, 99);
   
    cout << CombatLevel;
    cin.get();
    return 0;


}

_________________
Back to top
View user's profile Send private message MSN Messenger
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Fri Jan 09, 2009 9:16 pm    Post subject: Reply with quote

Evil or Very Mad
Code:

#include <iostream>
#include <string>
#include "combatclass.cpp"
using namespace std;

void err (float eprob);
double getCombat(double att, double str, double def, double hp, double mage, double range, double pray);

double getCombat(double att, double str, double def, double hp, double mage, double range, double pray) {
    string combat_class;
   
    double cmblvl = (0.32707 * att) + (0.249 * def) + (0.324 * str) + (0.25 * hp) + (0.124 * pray);
    double rangelvl = (0.487 * range) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
    double magelvl = (0.487 * mage) + (0.249 * def) + (0.25 * hp) + (0.124 * pray);
   
    if ((cmblvl > magelvl) && (cmblvl > rangelvl)) {
        combat_class = "Warrior";
    }
    else if ((rangelvl > magelvl) && (rangelvl > cmblvl)) {
        combat_class = "Ranger";
        cmblvl = rangelvl;
    }
    else if ((magelvl > cmblvl) && (magelvl > rangelvl)) {
        combat_class = "Mage";
        cmblvl = magelvl;
    }
    else {
        combat_class = "Warrior";
    }
   
    return cmblvl;
   }

int main()
{       
    double CombatLevel = getCombat(99, 99, 99, 99, 99, 99, 99);
    cout << CombatLevel;
    cin.get();
    return 0;
}


decline to comment

regards BanMe
Back to top
View user's profile Send private message MSN Messenger
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Sat Jan 10, 2009 1:18 am    Post subject: Reply with quote

@JVlania
Why did you add #include "combatclass.cpp"? you are including the file within itself.. remove it, and the declaration of err() seems equally pointless without putting it to use. Read up on the basics so you have a better understanding of what you are doing.
Back to top
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Sat Jan 10, 2009 1:16 pm    Post subject: Reply with quote

The combatclass.cpp is a different .cpp. The one I am using is combatcalc.cpp. I did not include it this time though.

Oh, and when I use Visual C++ I right click on the .cpp and click on
"build" but on the bottom box it says:
"------ Build started: Project: combatcalc, Configuration: Debug Win32 ------
There is no build command line to execute.

Performing Makefile project actions
Project : error PRJ0003 : Error spawning 'cmd.exe'.
Build log was saved at "file://c:\docs\CS250\CombatCalc\combatcalc\Debug\BuildLog.htm"
combatcalc - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========="

Then I tried again with the cmd app...g++ combatcalc.cpp -o combat.exe it worked! Then I click on combat.exe and all that comes up is the cmd window saying "126.133" Shocked
I used the code BanMe wrote. With out including combatclass.

I am thinking maybe the "126.133" could be the product I am getting from the "99s" in my script. Thus 126.133 would be my combat level? Confused

Yes, my assumption was correct ^ Thanks to all especially BanMe.

_________________
Back to top
View user's profile Send private message MSN Messenger
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Sat Jan 10, 2009 2:01 pm    Post subject: Reply with quote

My bad lol, I need my eyes checked. Regarding that visual studio error, try -> http://www.google.com/search?q=Error+spawning+cmd.exe
Back to top
View user's profile Send private message
crayzbeef
Expert Cheater
Reputation: 0

Joined: 21 Jan 2007
Posts: 101

PostPosted: Sun Jan 11, 2009 1:18 am    Post subject: Reply with quote

May i ask why you're inefficiently using doubles for every type of variable?
Back to top
View user's profile Send private message
Cloud-Strife
Master Cheater
Reputation: 0

Joined: 14 Mar 2008
Posts: 346
Location: MilkyWay

PostPosted: Sun Jan 11, 2009 3:59 pm    Post subject: Reply with quote

crayzbeef wrote:
May i ask why you're inefficiently using doubles for every type of variable?


It is an inperfect replica version of a combat calculator formula that a company called Jagex made up for their game RuneScape. Supposedly it requires doubles for every variable?

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites