Gui problems:Scripted functions doesn't work on a custom map
-
- Posts:9
- Joined:2013-08-30, 19:37
Hello Carsten, i have a problem here when i was testing my own map.
I created a Gui with basics functions (spining characters, glowing buttons, those things) and it works perfectly on the live preview.
But when i am working on the map, i can only see my cursor but i can't do anything at the gui...
I have tested on another map (BPWxBeta) and it works fine... i also, tested the teleporter gui, this time on my map, and it does'nt do anything too.
¿What's the problem? ¿Do i have to configure anything on a custom map before i can use a gui?
Thank you very much if you read this Carsten.
I created a Gui with basics functions (spining characters, glowing buttons, those things) and it works perfectly on the live preview.
But when i am working on the map, i can only see my cursor but i can't do anything at the gui...
I have tested on another map (BPWxBeta) and it works fine... i also, tested the teleporter gui, this time on my map, and it does'nt do anything too.
¿What's the problem? ¿Do i have to configure anything on a custom map before i can use a gui?
Thank you very much if you read this Carsten.
Re: Gui problems:Scripted functions doesn't work on a custom
Hi Sacramento,
nice to hear from you!
And what do you mean by "i can't do anything"?
Does the mouse cursor (not) move?
Will mouse "clicks" (not) be processed?
nice to hear from you!
Can you please refresh me on what version of the engine you're using?Sacramento wrote:But when i am working on the map, i can only see my cursor but i can't do anything at the gui...
And what do you mean by "i can't do anything"?
Does the mouse cursor (not) move?
Will mouse "clicks" (not) be processed?
A quick shot: In the "GUI Inspector" dialog, is the property "Interactive" checked [✔] ?¿What's the problem? ¿Do i have to configure anything on a custom map before i can use a gui?
Best regards,
Carsten
Carsten
-
- Posts:9
- Joined:2013-08-30, 19:37
Re: Gui problems:Scripted functions doesn't work on a custom
Hi Carsten, nice to see you again
The version i'm using is :
I mean... I can't use the functions of the gui that i writed on the lua scrip file.
The cursor is good ( i had some problems to assing a proper image, but i solved that by copy the cmat file from the original teleporter gui, if there is a better why to do it, please let me know).
The mouse clicks won't work, i click on the buttoms i made and nothing happens, the gui look like it was frozen.
When i load the map, the gui appear on the terminal and all, but it seems like the lua code isn't running on MY MAP.
When i tested this on the custom maps that cafu bring, everything is ok.
¿I was clear enough? sorry if i'm dificulty to read.
The version i'm using is :
Code: Select all
Cafu-bin-2013-04-27-9e48f96-win32
I mean... I can't use the functions of the gui that i writed on the lua scrip file.
The cursor is good ( i had some problems to assing a proper image, but i solved that by copy the cmat file from the original teleporter gui, if there is a better why to do it, please let me know).
The mouse clicks won't work, i click on the buttoms i made and nothing happens, the gui look like it was frozen.
When i load the map, the gui appear on the terminal and all, but it seems like the lua code isn't running on MY MAP.
When i tested this on the custom maps that cafu bring, everything is ok.
¿I was clear enough? sorry if i'm dificulty to read.
Re: Gui problems:Scripted functions doesn't work on a custom
Hi,
My "problem" is that I rewrote the whole GUI and entity system (as outlined here) in the meanwhile (it's all still under development though), so I have to set myself "back in time" to understand what might be the cause for your issue.
So here's a suggestion:
Yes, thanks for providing the information!Sacramento wrote:¿I was clear enough? sorry if i'm dificulty to read.
My "problem" is that I rewrote the whole GUI and entity system (as outlined here) in the meanwhile (it's all still under development though), so I have to set myself "back in time" to understand what might be the cause for your issue.
So here's a suggestion:
- If you've checked the " [✔] Interactive" checkbox in the GUI editor, and
- the in-game console does not provide you with a clue about what might have gone wrong,
- could you then please send your map and GUI files to my email address (info@cafu.de)?
.cmap
and the main and init .cgui
files, so that I can check things out. Best regards,
Carsten
Carsten
-
- Posts:9
- Joined:2013-08-30, 19:37
Re: Gui problems:Scripted functions doesn't work on a custom
Yep, i didIf you've checked the " [✔] Interactive" checkbox in the GUI editor
Nope, nothingthe in-game console does not provide you with a clue about what might have gone wrong
im sending you a mail with the files, i hope you can find what is wrong.
Re: Gui problems:Scripted functions doesn't work on a custom
Thanks! I got your email with the files, and will get back to you as soon as possible (maybe later today, but it may possibly take me 2 or 3 days).Sacramento wrote:im sending you a mail with the files, i hope you can find what is wrong.
Best regards,
Carsten
Carsten
Re: Gui problems:Scripted functions doesn't work on a custom
Ok, I've got it:
The problem was that in the detail model, you used the filename ending with
So in the detail model settings, if you replace "_init" with "_main", things will work.
I'm sorry for the trouble. Should we improve the documentation so that others don't step into the same issue?
Also, I've just committed change 79f5b47 to branch entity-component-system, so that this problem is clearly seen and easily defused in the future. Please see the attached screenshot for the result: it works this way both in the Cafu Engine and in the Map Editor.
The problem was that in the detail model, you used the filename ending with
*_init.cgui
. This however loads only the static parts of your GUI, not the custom script definitions, which are in *_main.cgui
(which in turn loads the parts in *_init.cgui
automatically).So in the detail model settings, if you replace "_init" with "_main", things will work.
I'm sorry for the trouble. Should we improve the documentation so that others don't step into the same issue?
Also, I've just committed change 79f5b47 to branch entity-component-system, so that this problem is clearly seen and easily defused in the future. Please see the attached screenshot for the result: it works this way both in the Cafu Engine and in the Map Editor.
Best regards,
Carsten
Carsten
-
- Posts:9
- Joined:2013-08-30, 19:37
Re: Gui problems:Scripted functions doesn't work on a custom
Yes now i can finally use my customs GUI!
Thank you so much Carsten
i always like reading manuals and stuff to understand better what im doing, i was stuck in this problem for days .
You know, i think you should update the documentation for the current version of Cafu (some things in the teleporter tutorials does'nt fit at all ).
Again, thank you
Thank you so much Carsten
Yes please, it will be more better if we could understand more the engine dinamic by putting more detailed information about it.Should we improve the documentation so that others don't step into the same issue?
i always like reading manuals and stuff to understand better what im doing, i was stuck in this problem for days .
You know, i think you should update the documentation for the current version of Cafu (some things in the teleporter tutorials does'nt fit at all ).
Again, thank you
Re: Gui problems:Scripted functions doesn't work on a custom
It's good to hear that, thanks for the feedback!Sacramento wrote:Yes now i can finally use my customs GUI!
Thank you so much Carsten
Well, I actually wrote the suggestion to update the docs before I added the extra check as displayed in the screenshot in my previous post, which kind of makes a documentation update redundant. Also please see below for another thought on docs update.Yes please, it will be more better if we could understand more the engine dinamic by putting more detailed information about it.Should we improve the documentation so that others don't step into the same issue?
I too love reading good documentation... writing it is a hard job, though...i always like reading manuals and stuff to understand better what im doing, i was stuck in this problem for days .
I'm sorry for the trouble you've had with this issue!
Thanks for pointing that out!You know, i think you should update the documentation for the current version of Cafu (some things in the teleporter tutorials does'nt fit at all ).
Can you please tell what exactly doesn't fit? Even better, as this is a Wiki into which you can login with the same username and password as in this forum, could you please update this yourself?
Note however that there is a small issue involved: As anticipated in my news post More about Component Systems, things like these are going to change quite a bit in the future. So at this time, it is probably a good idea to fix obvious major problems in this tutorial, but any polishing and detail work should probably wait until mappers can actually assemble entities from components in the Map Editor...
Best regards,
Carsten
Carsten
-
- Posts:9
- Joined:2013-08-30, 19:37
Re: Gui problems:Scripted functions doesn't work on a custom
Hi Carsten, sorry for the late reply.
"Creating Teleporter Station" tutorial.
If we compare this with the example that cames with Cafu
They are not the same, i dont know if im wrong at reading the lua language, but they are mising things like the ; or it cames with diferent sintax.
¿Im right and i must fix it? or ¿i should ignore it?
here, this is a fragment code that is showing up in theCan you please tell what exactly doesn't fit? Even better, as this is a Wiki into which you can login with the same username and password as in this forum, could you please update this yourself?
"Creating Teleporter Station" tutorial.
Code: Select all
function ButtonGo:OnMouseButtonUp()
local origNr=OUR_NODE_NR;
local destNr=DestNode:get("text");
game.runMapCmd("teleport(" .. origNr .. ", " .. destNr .. ");");
return true;
end
Code: Select all
function ButtonGo:OnMouseButtonUp()
local origNr = OUR_NODE_NR
local destNr = DestNode:GetComponent("Text"):get("Text")
Entity:RunMapCommand("teleport(" .. origNr .. ", " .. destNr .. ");");
return true;
end
¿Im right and i must fix it? or ¿i should ignore it?
Re: Gui problems:Scripted functions doesn't work on a custom
Hi Sacramento,
In Lua, semicolons are largely optional, and while I used to use them in older scripts, nowadays my preferred Lua-style is to omit them wherever possible (although in the above fragment, it looks like I only changed this in lines that I actually edited, not globally in the entire script).
(The second purely stylistic change is that I now use a single space around most binary operators, e.g.
More importantly, and this is the good news, is that the above code uses GUI components already. That in turn means that these things are already up to date, and will not need to change again when the entity component system is released.
That means, my above guess was wrong, and changes made to the related Wiki page are worthwhile.
So if you don't mind, please update the Wiki page with the new code!
This is the right, new and correct version.Sacramento wrote:[...] If we compare this with the example that cames with Cafu
Code: Select all
function ButtonGo:OnMouseButtonUp() local origNr = OUR_NODE_NR local destNr = DestNode:GetComponent("Text"):get("Text") Entity:RunMapCommand("teleport(" .. origNr .. ", " .. destNr .. ");"); return true; end
In Lua, semicolons are largely optional, and while I used to use them in older scripts, nowadays my preferred Lua-style is to omit them wherever possible (although in the above fragment, it looks like I only changed this in lines that I actually edited, not globally in the entire script).
(The second purely stylistic change is that I now use a single space around most binary operators, e.g.
a = b + 3
rather than a=b+3
.)More importantly, and this is the good news, is that the above code uses GUI components already. That in turn means that these things are already up to date, and will not need to change again when the entity component system is released.
That means, my above guess was wrong, and changes made to the related Wiki page are worthwhile.
So if you don't mind, please update the Wiki page with the new code!
Best regards,
Carsten
Carsten
Who is online
Users browsing this forum: No registered users and 48 guests