Catching the checkpoint event does not work (for me)

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Catching the checkpoint event does not work (for me)

Post by undef.de »

I'm not very familiar with ManiaScript yet and i have tried many variations to get what i wanna do... but nothing works as i want...

In my XAseco plugin Records-Eyepiece i want to add ManiaScript to build the CheckpointCount-Widget instead of build it in PHP like it now is.

I tried this, but it does not log anything:

Code: Select all

while (True) {
	foreach (Event in PendingEvents) {
		switch (Event.Type) {
			case CTmModeEvent::EType::WayPoint : {
				log("Checkpoint reached...");
			}
		}
	}
	yield;
}
Then i tried this, to see which events are fired:

Code: Select all

while (True) {
	foreach (Event in PendingEvents) {
		log(Event.Type);
	}
	yield;
}
and all i get is "Type::KeyPress" when i drive through a checkpoint.

Why is CTmModeEvent::EType::WayPoint are not fired, did i miss something? Does this only works in GameMode-Scripts?
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Catching the checkpoint event does not work (for me)

Post by Eole »

undef.de wrote:Why is CTmModeEvent::EType::WayPoint are not fired, did i miss something? Does this only works in GameMode-Scripts?
Yes. The events caught in a ManiaLink script are only related to this ManiaLink and not the game mode. The two can communicate, but it must be implemented in the game mode first.

http://tmrankings.com/maniascript/html/ ... event.html
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
Jojo_44
Posts: 485
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: Catching the checkpoint event does not work (for me)

Post by Jojo_44 »

Really the gamemode can communicate with a server manialink without going over the dedicated server callbacks ? Can you give an example on how to fire a event in a gamemode which can be catched at a manialink ?

thanks, Jojo
Image
my english sounds very unfriendly but it isn´t ;)
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Catching the checkpoint event does not work (for me)

Post by The_Big_Boo »

This is done by having netread/netwrite variables in both gamemode script and manialink script. For instance, this is used for weapon selection in SM (there is a local manialink for each player but the choice must obviously be taken in account by the gamemode).
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Catching the checkpoint event does not work (for me)

Post by undef.de »

Eole wrote:
undef.de wrote:Why is CTmModeEvent::EType::WayPoint are not fired, did i miss something? Does this only works in GameMode-Scripts?
Yes. The events caught in a ManiaLink script are only related to this ManiaLink and not the game mode. The two can communicate, but it must be implemented in the game mode first.
This means, that i can't do what i want with default game modes like TimeAttack, Rounds... in TM2? Because these didn't fire the WayPoint event?
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: Catching the checkpoint event does not work (for me)

Post by w1lla »

http://forum.maniaplanet.com/viewtopic. ... 80#p137672

This is a test script i did for Trackmania 2 Canyon.
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
User avatar
Jojo_44
Posts: 485
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: Catching the checkpoint event does not work (for me)

Post by Jojo_44 »

w1lla wrote:http://forum.maniaplanet.com/viewtopic. ... 80#p137672

This is a test script i did for Trackmania 2 Canyon.
Thanks man ;) In fact you can rewrite f.e. the teammode in Trackmania2 and implement some netread/netwrite stuff and the records eyepiece manialink recognize f.e. a player now starts and can hide the widgets. The same for a player finish the run -> show widgets. Ofc you can do this already but it produces a lot of traffic going from the servercontroller to the dedicated server. Great stuff, even greater if eole implements this in all nadeo scripts :D

regards, Jojo
Image
my english sounds very unfriendly but it isn´t ;)
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Catching the checkpoint event does not work (for me)

Post by Eole »

Jojo_44 wrote:Really the gamemode can communicate with a server manialink without going over the dedicated server callbacks ? Can you give an example on how to fire a event in a gamemode which can be catched at a manialink ?

thanks, Jojo
You can also check this topic: http://forum.maniaplanet.com/viewtopic. ... 01&start=0
There's some examples in it. Do not hesitate to ask for more details if needed.
Jojo_44 wrote:Great stuff, even greater if eole implements this in all nadeo script
Till now I didn't work on ManiaScript with TM². I'm not even sure the modes (beside Platform) have been translated to script or if it's still harcoded. ^^'
undef.de wrote:This means, that i can't do what i want with default game modes like TimeAttack, Rounds... in TM2? Because these didn't fire the WayPoint event?
The WayPoint event is fired in the default game modes. But it's not sent afterwards to the client UI. So you can't access it from a ManiaLink. To do that you'll have to use a custom game mode.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Catching the checkpoint event does not work (for me)

Post by undef.de »

Eole wrote:
undef.de wrote:This means, that i can't do what i want with default game modes like TimeAttack, Rounds... in TM2? Because these didn't fire the WayPoint event?
The WayPoint event is fired in the default game modes. But it's not sent afterwards to the client UI. So you can't access it from a ManiaLink. To do that you'll have to use a custom game mode.
Nah... i don't go and rebuild all the custom gamemodes just to have the ability to fire the WayPoint event and to be able to used it then in my HUD.

Thanks anyway, now i know that i didn't have to investigate more time into ManiaScript and can let my HUD as it is.
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Catching the checkpoint event does not work (for me)

Post by undef.de »

Eole wrote:
undef.de wrote:This means, that i can't do what i want with default game modes like TimeAttack, Rounds... in TM2? Because these didn't fire the WayPoint event?
The WayPoint event is fired in the default game modes. But it's not sent afterwards to the client UI. So you can't access it from a ManiaLink. To do that you'll have to use a custom game mode.
I'm just thinking about a suggestion: Why not add an option to enable the ability to receive such events into a Manialink (maybe selectable each event that is wanted)? That would prevent overstressing all Manialinks and enable Manialinks to catch the events when they are needed.

Because i think that the events (e.g. WayPoint) are fired from the client and are send to the dedicated server, then it would be nice to have access client-side to it also to make HUDs much more stressless for the dedicated server, controller, network... :thumbsup:
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest