Help with a tool's code

General/other thps modding discussion
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Help with a tool's code

Postby ZurePitchmen83 » Tue Oct 30, 2012 1:30 am

I'm trying to make a modding tool for THPS3/4 and i can't compile it, more info here

http://thmods.com/forum/viewtopic.php?f=8&t=292

What do i need to do for it to compile?, i used wxDev-C++ 7.4.2.569 with Default GCC compiler
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Help with a tool's code

Postby WhoElseButMe » Tue Oct 30, 2012 6:18 am

first and foremost pkr files are not pre files
pkr files do contain the first version of pre files but they are NOT the same as anything thps3 and newer
There are several variables you will need to conform to in order to read and write these files properly, i'll let you figure those out on your own. You'll also want to use a method of parsing that can accept variable change, for files built by other tools and/or by hand.

Ultimately your problem is your items are out of scope and/or never instantiated at all

Code: Select all

public int CanBeSeenByAnotherMethod = 0;
public void PassTheSize()
{
   int size = 1000;
   int cantbeseenbyanothermethod = 2000;
   CanBeSeenByAnotherMethod = 3000;
   CatchTheSize(size, cantbeseenbyanothermethod);
}
public void CatchTheSize(int size1, int size2)
{
   // this will throw a compiler error because "cantbeseenbyanothermethod" is out of scope and "not declared"
   int newSize = 0;
   MessageBox.Show(string.Format("OldSize: {0}, {1}, {2}\nNewSize: {3}\nOutOfScopeInt: {4}", size1, size2, CanBeSeenByAnotherMethod, newSize, cantbeseenbyanothermethod));
}

You can either pass the variable to the method, declare the variable inside the method, or declare a property and asign a value to that property, but you CANNOT see a variable declared inside of another method, get it?
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: Help with a tool's code

Postby ZurePitchmen83 » Tue Oct 30, 2012 6:36 am

WhoElseButMe wrote:first and foremost pkr files are not pre files
pkr files do contain the first version of pre files but they are NOT the same as anything thps3 and newer

I knew that, Your code didn't work for me, i even removed the part you said wouldn't work and that didn't work either, i tried using prereaper's code and it didn't work either :(

Code: Select all

The error it throws at me

105 expected unqualified-id before 'public'
116 expected declaration before '}' token

What's wrong?, how can i properly read PRE files with no compiling error
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Help with a tool's code

Postby WhoElseButMe » Tue Oct 30, 2012 6:38 am

that code isn't written in wx whatever
it was for visual purposes only so you can see which objects were being declared and which one wasn't

In the code above you have 1 property and 2 methods. Both variables declared in method one are passed to method two so now method two can use their values. It can also use the property value because it isn't scope specific. The problem in the code above comes when I try and use the declared variables name from method one in method two which method two can't see. It doesn't exist as far as the second method is concerned, instead "size2" represents that variables value.
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: Help with a tool's code

Postby ZurePitchmen83 » Tue Oct 30, 2012 6:40 am

wxDev-C++ supports VC Compilers though, but they're not included, i don't know if they'll work with compiling my tool though, do i need to add something extra for your code to work? (like reading file header or something), i'm a beginner at C++
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Help with a tool's code

Postby WhoElseButMe » Tue Oct 30, 2012 6:52 am

you need to rewrite it for the code to work, its written in c#.
remove the public's and rewrite the messagebox in a way that wxDev likes and it should compile fine.
static string.Format is c# so you'll need to do something like
CString s;
s.Format(_T("OldSize: %d, %d, %d\nNewSize: %d\nOutOfScopeInt: %d"), size1, size2, CanBeSeenByAnotherMethod, newSize, cantbeseenbyanothermethod);
AfxMessageBox(s, MB_OK);
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.

Return to “Other THPS games modding”

Who is online

Users browsing this forum: No registered users and 28 guests