I need help for adding data/XML dynamically in manialink

Talk about ManiaLink development in this forum

Moderator: NADEO

Post Reply
TheBigMiike
Posts: 1256
Joined: 06 Mar 2013, 16:12
Location: Vendée | France
Contact:

I need help for adding data/XML dynamically in manialink

Post by TheBigMiike »

Hello everyone.

For a week now, I'm looking for a system that add data / XML dynamically in my manialink.

An example:
- When a player do an action on my manialink. An HTTP request is sended to a website.
- Then the website gives a response (JSON or XML returned).

- My manialink display the response

In red is the thing I want your help...
I don't know how to display the results returned.

I tried two things :

1 - Create a layer
... but this doesn't work.

The following code was found on numerous code I saw ingame (livemenu.maniaplanet.com or something like this...) and in the official documentation

Code: Select all

declare CUILayer MyLayer;
MyLayer = UILayerCreate();
MyLayer.Type = CUILayer::EUILayerType::Normal // Is it correct ?
But ManiaScript hate me ._. so he says that I don't have access to Type
Tried to set content in ManialinkPage attribute and the same error is displayed.

2 - Use a JSON parser library
I want to include a JSON library but the declaration part and the functions of this library are all placed at the top of the script so ManiaScript doesn't like that. I need to copy all the functions and the variable declarations directly in my own code but ManiaScript doesn't like that too : Variable are declared but ManiaScript says no.

So I want your help.
Have you a third solution ?
Can we create layers in manialinks ?
Is the first code incorrect ?
Image Image
zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: I need help for adding data/XML dynamically in manialink

Post by zocka »

Have you a third solution ?
Prepare a sufficient amount of controls/create the "view" for your data in a hidden frame or something. As we can't scroll Manialinks either, the code should be limited.
Can we create layers in manialinks ?
This only works for GUI Manialinks, not for the classical manialinks like you want to create.
Is the first code incorrect ?
Might be, but not for this usecase.

Regarding your JSON issues: I got my library working and whenever I use something like that, I do it as answered for your first question.
After some time working with android at that time, I came up with this kind of structure

Code: Select all

Namespace_Inflate(Frame, Data) {
  Frame.ControlXy.Value = Data[...]
  // etc.
}
Namespace_Adapter(Data) {
  foreach (Frame in DestinationFrames)
    Namespace_Inflate(Frame, Data[i])
}
Namespace_Callback(_HttpRequestResponse) {
  // parse response
  // store data in local structure
  Namespace_Adapter(Data)
}
If you need it, I can get you actual sample code
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka
Post Reply

Return to “ManiaLink”

Who is online

Users browsing this forum: No registered users and 1 guest