|
Post by Alexis on Aug 24, 2012 20:26:34 GMT
But Explode didn't call the export function, so why did it work? Anyway it's very interesting. But i don't understand your two last sentences.
|
|
Explode
Professional Marbler
I like C4 . :D
Posts: 482
|
Post by Explode on Aug 25, 2012 15:19:09 GMT
And you can do that with any variable, you don't have to just export prefs. Also lamp could have also just made a new .cs file too What he said. Also, I think lamp has an export system in the project I used to test it in T3D.
|
|
|
Post by Alexis on Aug 25, 2012 15:50:54 GMT
I just said i didn't understand his two last sentences, which you just quoted me as an answer. I don't see, Jeff, what you mean by "you don't have to just export prefs".
|
|
|
Post by Jeff on Aug 25, 2012 16:36:09 GMT
I was saying that you can save any $global variable to a file, it does not have to start with $pref::
|
|
|
Post by Alexis on Aug 25, 2012 16:54:24 GMT
Yes, but if it starts with $pi:: is it necessary to add the export() line in the onExit function?
|
|
|
Post by Jeff on Aug 25, 2012 16:55:59 GMT
No, export is only used for saving variables, like saving highscore data and stuff. once again the :: means nothing, its just organization.
|
|
|
Post by Alexis on Aug 25, 2012 17:00:37 GMT
export is only used for saving variables, like saving highscore data and stuff I know, i wanted to know if export was necessary to save the variable when you quit the game. As i can see it is. I didn't mean to especially use the variable during MB's execution (which is not complicated), just to save its value when you quit the game. Anyway thanks a lot, i think i've understand.
|
|
|
Post by Alexis on Dec 31, 2012 22:16:16 GMT
Bump. I have two questions to ask.
How can i remove the intro before the main menu? I think i have to delete or modify the function "runPresentation();" but i can't find it anywhere? Is it already in a compiled file?
What's the function to repeat a function for a chosen time?
|
|
|
Post by Jeff on Dec 31, 2012 22:18:37 GMT
#2 schedule(time delay in milliseconds, 0, "methodname", args);
|
|
|
Post by Alexis on Dec 31, 2012 22:23:53 GMT
Thanks a lot, it will be useful ^^.
What does the second argument mean?
|
|
|
Post by Jeff on Dec 31, 2012 22:55:05 GMT
Never looked it up, but its suppost to deal with objects...just use 0, I always use zero.
If you need to schedule a method on an object, use:
%obj.schedule(time in ms, "method", args);
|
|
|
Post by Alexis on Dec 31, 2012 23:02:15 GMT
Ok thanks.
|
|
|
Post by Alexis on Jan 3, 2013 13:58:26 GMT
Bump I have another question. I would like to create a GUI which give you the list of missions in the "missions" folder, and you can select a mission and click on a button to play it. What is a GUI object to make this kind of list ? And what are the methods i'll have to use for it ? Thanks. BTW is there a reference with the list of GUI objects and their methods in torquescript?
|
|
|
Post by Jeff on Jan 3, 2013 20:02:40 GMT
you can google the torqueScript reference manual.
use a guiTextListCtrl()
to add a row, do:
nameOfObject.addRow(nameOfObject.rowCount(),"text to be added");
to get a row, use an index, starting with row "0"
%row = nameOfObject.getRowTextById(nameOfObject.getSelectedId());
to clear a list, use this:
nameOfObject.clear();
any further questions just ask, i'll be happy to assist!
~Jeff
|
|
|
Post by Alexis on Jan 3, 2013 20:44:58 GMT
Thank you Jeff but i don't get some things... When i want to add a row: (nameOfObject.addRow(nameOfObject.rowCount(),"text to be added"); ) What object is the second argument and with what i want to do, the text to be added is a mission name?
|
|
|
Post by Jeff on Jan 3, 2013 21:11:43 GMT
Thats what you want to add, you can make it a string, an object, pass in a variable, do whatever you want.
|
|
|
Post by Alexis on Jan 4, 2013 12:53:59 GMT
Thanks, last thing, what's the second "name of object" ? Ad why did you put "rowcount()" after it ?
|
|
|
Post by Jeff on Jan 5, 2013 3:45:11 GMT
name of object is just the name you gave the scroll gui object =) rowcount tells the engine "HEY, I NEED ANOTHER ROW, BUMP ME UP A LEVEL" kind of deal.
|
|
|
Post by Alexis on Jan 5, 2013 12:09:16 GMT
Awesome.. it's working fine. Thanks again I still need a help for something... i don't know how to get the list of every missions in the missions folder, how can i do that ?
|
|
|
Post by Jeff on Jan 5, 2013 17:02:31 GMT
missionlistobj.clear(); for (%file = findFirstFile("marble/data/missions/beginner/*.mis"); %file !$= ""; findNextFile("marble/data/missions/beginner/*.mis")) { // now do the adding thing, the mission file is stored in %file }
|
|
|
Post by Alexis on Jan 5, 2013 18:54:35 GMT
What you gave me is an infinate loop Fixed it. You forget a %file = findNextFile("marble/data/m[...] How do i add a scroller?
|
|
|
Post by Jeff on Jan 6, 2013 5:35:48 GMT
make a guiScrollControl and add the list inside of the scroll control
also sorry about the infinate loop lol, I indeed forgot %file :X
|
|
|
Post by Alexis on Jan 6, 2013 16:24:49 GMT
Everything is working , thanks Jeff
|
|
Ben
Beginner Marbler
Happy Roll Level Buider & Programmer
Posts: 72
|
Post by Ben on Jan 13, 2013 12:44:10 GMT
How can I play a certain background music in a certain level?
|
|
|
Post by Buzz Carols on Jan 13, 2013 15:57:45 GMT
Convert your song to a .ogg file (if it isn't already) and put it in your marble/data/sound/music directory (if it's in MBP, it's "platinum" instead of "marble"). Then in your level, add a dynamics field and call it "music". For the value, use the name of your song (with the .ogg extension).
|
|
|
Post by Alexis on Jan 13, 2013 19:55:16 GMT
What's the function to unload the current loaded mission? Please don't tell me disconnect() This function also leads me to the playMissionGui.
|
|
|
Post by Jeff on Jan 13, 2013 20:04:19 GMT
that is the function ^
If you want to just load another one while playing one, do
loadMission("marble/data/missions/beginner/bla.mis");
|
|
|
Post by Alexis on Jan 13, 2013 20:10:59 GMT
The game just crash when i try to load two missions at once. Well... i was wrong, it's working, thanks
|
|
FruBlox
Advanced Marbler
[ss:Default Skin (DO NOT TOUCH)]
It's marbling time!
Posts: 338
|
Post by FruBlox on Mar 21, 2013 1:54:19 GMT
Been a while since the last post, but I do have a question.
For binding functions to keys, how do you prevent running the function multiple times when the key is held down? I want to make it so that: 1 press = 1 function execution
EDIT: Apparently the reason the function is executing twice is because the function runs once when the key is pressed and once more when the key is released. How do I just make it run once and ignore when the key is released?
|
|
|
Post by Aayrl on Mar 22, 2013 12:06:12 GMT
Not entirely sure if there is a cleaner way of doing this, I'll let Jeff provide input as well.
Because of the nature of the key binding in this engine, it may not be possible to tell it to fire one function per button press. However, we can implement some hackish code;
Setup a global variable, something like $functionname_Toggled = False
Now enclose everything in your function with an if-statement that requires functionname_Toggled to be false. Additionally, inside of your if-statement, near the end, insert $functionname_Toggled = True and a schedule to set $functionname_Toggled = False a couple seconds later. This will force the function to run once and not allow itself to be executed until the schedule re-flags the Boolean to be false once more.
Hopefully this helps,
~Aayrl
|
|