netread variables in custom campaign script

Discuss everything related to custom data creation.

Moderator: NADEO

Post Reply
User avatar
Blueplayer
Posts: 170
Joined: 05 Apr 2011, 17:34

netread variables in custom campaign script

Post by Blueplayer »

Hi all,

I have an issue with scripting a custom solo campaign in a titlepack.
I have created a manialink which I load into UIAll like this:

Code: Select all

declare mapSelector = UIManager.UILayerCreate();
UIManager.UIAll.UILayers.add(mapSelector);
mapSelector.ManialinkPage = """[...]""";
In this manialink I create now some netwrite variables...

Code: Select all

main () {
	declare netwrite mapSwitchNow for UI = 0;
	declare netwrite selectedMap for UI = 0;
	[...]
}
After this code I´ve added the netread variable declaration:

Code: Select all

declare netread mapSwitchNow for UIManager.UIAll = 0;
declare netread selectedMap for UIManager.UIAll = 0;
In this part I get the following error message:

Code: Select all

The objects of type CGamePlaygroundUIConfig does not support declaration of attribute mapSwitchNow.
As far as I understand this message, netread variables are not yet compatible with scripts in titlepack-solomodes. Or am I wrong?
Would be really sad, because then I wouldn´t be able to create a very cool solomode... :P


Pls also remember my last post in the other thread about solo-campaign scripting
User avatar
spaii
Posts: 1075
Joined: 19 Jun 2010, 00:04
Location: Rémy - France
Contact:

Re: netread variables in custom campaign script

Post by spaii »

Concerning netread/netwrite : viewtopic.php?f=279&t=19067&start=10#p163721
User avatar
Blueplayer
Posts: 170
Joined: 05 Apr 2011, 17:34

Re: netread variables in custom campaign script

Post by Blueplayer »

Thanks for the link. :thumbsup:
If I want to create the netread variables on an UI-object or a player-object, I get error messages.

I´m now using this:

Code: Select all

declare netread mapSwitchNow for Teams[0] = 0;
declare netread selectedMap for Teams[0] = 0;
This works and because it´s a solomode it´s fine for my purpose. :)
User avatar
spaii
Posts: 1075
Joined: 19 Jun 2010, 00:04
Location: Rémy - France
Contact:

Re: netread variables in custom campaign script

Post by spaii »

What is the error message ?
User avatar
Blueplayer
Posts: 170
Joined: 05 Apr 2011, 17:34

Re: netread variables in custom campaign script

Post by Blueplayer »

Try #1 - with UI Objects
Code:

Code: Select all

declare netread mapSwitchNow for UIManager.UIAll = 0;
declare netread selectedMap for UIManager.UIAll = 0;
Errormessage:

Code: Select all

The objects of type CGamePlaygroundUIConfig does not support declaration of attribute mapSwitchNow.
Try #2 - with Player Objects
Code:

Code: Select all

foreach (Player in Players) {
  declare netread mapSwitchNow for Player = 0;
  declare netread selectedMap for Player = 0;
}
Errormessage:

Code: Select all

The objects of type CTmRaceRulesPlayer does not support declaration of attribute mapSwitchNow.

I also tried something like this:

Code: Select all

foreach (Player in Players) {
  declare userUI = UIManager.GetUI(Player);
  declare netread mapSwitchNow for userUI = 0;
  declare netread selectedMap for userUI = 0;
}
This code did not show up any error codes, but I couldn´t use userUI outside the foreach part (variable not found)... maybe I just messed up = and <=>, but I´m not sure about it.
I did not any further tests. I started using Teams[0]...
User avatar
spaii
Posts: 1075
Joined: 19 Jun 2010, 00:04
Location: Rémy - France
Contact:

Re: netread variables in custom campaign script

Post by spaii »

In manialink :

Code: Select all

declare netwrite Net_Variable for UI = 0;
In game mode script :

Code: Select all

declare SoloPlayer <=> AllPlayers[0];
declare UI <=> UIManager.GetUI(SoloPlayer);
if (UI != Null) {
declare netread Net_Variable for UI = 0;
}
Other solution for game mode script :

Code: Select all

foreach (Player in AllPlayers) {
declare UI <=> UIManager.GetUI(Player);
if (UI == Null) continue;
declare netread Net_Variable for UI = 0;
}
Post Reply

Return to “Title Pack & Custom Data Creation”

Who is online

Users browsing this forum: No registered users and 1 guest