Help with command stuff

Started by Architect, April 25, 2014, 05:20:09 PM

Previous topic - Next topic

Architect

I know I would generally post this under Mod Help, but I need to post the latest version of my full mod for this issue.

I cannot get the Command_action stuff to work at all. I have literally copied and pasted Haplo's source stuff on several occasions, taken advice from pawnstorm, and spent hours fiddling, all to literally no avail. I physically cannot figure out why what I have doesn't work, I even moved on to thinking it might be an issue with my XML stuff, and spent an hour fiddling with that, and I am at ends tether with it. Everytime I click my conveyor belts instead of being presented with the UI buttons for loading, the entire games UI gets removed, and the output log gets spammed to high heaven. The little selection box rectangle doesnt even appear when you click and drag.

If anyone could just take a look at what I have to see the issue, and then look at my source and diagnose my issue, I would be unendingly grateful. Dropbox link: https://www.dropbox.com/s/lhxq41wpuluqdwq/BetterPower%2B.zip
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Tynan

Could you post the log with the message spam? Those error messages tell you (and/or me) the exact problem and the exact line it's on.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tynan

Only thing I can see that's wrong is that you should ideally set a groupKey.

com.groupKey = 12345;

Choose some random unique number. This helps the game group like commands when multiple items are selected.

Another note: generally you should never get textures from ContentFinder every frame. I know I do this in some old code but it's bad bad bad! Get them once on startup and save them.

Like:

private static Texture2D commandTex = ContentFinder.Get...etc

...

com.icon = commandTex;


Tynan Sylvester - @TynanSylvester - Tynan's Blog

Architect

Made the changes you suggested, still isn't working :/ Output log attached.

[attachment deleted by admin: too old]
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Tynan

This is the error:

MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'.

Since it's talking about thread management, which your code doesn't do and which the game doesn't do, it's probably some other issue.

I googled it and found this page:

http://stackoverflow.com/questions/15569664/system-missingmethodexception-int32-system-environment-get-currentmanagedthread

You'll also find lots of other relevant info if you just google the error.

Moving this to Mods/Help.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Architect

Quote from: Tynan on April 26, 2014, 01:06:49 PM
This is the error:

MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'.

Since it's talking about thread management, which your code doesn't do and which the game doesn't do, it's probably some other issue.

I googled it and found this page:

http://stackoverflow.com/questions/15569664/system-missingmethodexception-int32-system-environment-get-currentmanagedthread

You'll also find lots of other relevant info if you just google the error.

Moving this to Mods/Help.

Which explains why literally copying Haplo's source code for testing purposes still didn't work. I just figured it was something I was doing wrong with the actual programming, not my Visual Studios setup. Thanks a lot Tynan :D
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.