file Basic Marble Blast Coding Q&A

  • Posts: 240
  • Thank you received: 0
24 Aug 2012 22:26 #271
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.

Please Log in or Create an account to join the conversation.

  • Posts: 219
  • Thank you received: 1
25 Aug 2012 17:19 #272
Aug 24, 2012, 3:18pm, jeff wrote: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.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
25 Aug 2012 17:50 #273
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.

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
25 Aug 2012 18:36 #274
I was saying that you can save any $global variable to a file, it does not have to start with $pref::

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
25 Aug 2012 18:54 #275
Yes, but if it starts with $pi:: is it necessary to add the export() line in the onExit function?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
25 Aug 2012 18:55 #276
No, export is only used for saving variables, like saving highscore data and stuff. once again the :: means nothing, its just organization.

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
25 Aug 2012 19:00 #277
Aug 25, 2012, 11:55am, jeff wrote: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.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
01 Jan 2013 01:16 #278
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?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
01 Jan 2013 01:18 #279
#2 schedule(time delay in milliseconds, 0, methodname, args);

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
01 Jan 2013 01:23 #280
Thanks a lot, it will be useful ^^.

What does the second argument mean?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
01 Jan 2013 01:55 #281
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);

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
01 Jan 2013 02:02 #282
Ok thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
03 Jan 2013 16:58 #283
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?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
03 Jan 2013 23:02 #284
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

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
03 Jan 2013 23:44 #285
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?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
04 Jan 2013 00:11 #286
Thats what you want to add, you can make it a string, an object, pass in a variable, do whatever you want.

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
04 Jan 2013 15:53 #287
Thanks, last thing, what's the second name of object ? Ad why did you put rowcount() after it ?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
05 Jan 2013 06:45 #288
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.

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
05 Jan 2013 15:09 #289
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 ?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
05 Jan 2013 20:02 #290
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
}

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
05 Jan 2013 21:54 #291
What you gave me is an infinate loop

Fixed it. You forget a %file = findNextFile(marble/data/m[...]


How do i add a scroller?

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
06 Jan 2013 08:35 #292
make a guiScrollControl and add the list inside of the scroll control

also sorry about the infinate loop lol, I indeed forgot %file :X

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
06 Jan 2013 19:24 #293
Everything is working , thanks Jeff

Please Log in or Create an account to join the conversation.

  • UN1C0DE
  • UN1C0DE's Avatar
  • Offline
  • Beginner Marbler
  • Beginner Marbler
  • Happy Roll
  • Posts: 61
  • Thank you received: 5
13 Jan 2013 15:44 #294
How can I play a certain background music in a certain level?

Member of Roll Game Team
Programmer / Level Modeller / Background Music Designer
MarbleBlast::HappyRoll YEAH!!!!!!!!

Please Log in or Create an account to join the conversation.

  • Buzzmusic
  • Buzzmusic's Avatar
  • Offline
  • Developer
  • Developer
  • I make levels and songs.
  • Posts: 678
  • Thank you received: 145
13 Jan 2013 18:57 #295
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).

All posts from my account that were made before July 29 2013 are from the point of view of my dad unless it states otherwise.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
13 Jan 2013 22:55 #296
What's the function to unload the current loaded mission? Please don't tell me disconnect() This function also leads me to the playMissionGui.

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
13 Jan 2013 23:04 #297
that is the function ^

If you want to just load another one while playing one, do

loadMission(marble/data/missions/beginner/bla.mis);

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Posts: 240
  • Thank you received: 0
13 Jan 2013 23:10 #298
The game just crash when i try to load two missions at once.

Well... i was wrong, it's working, thanks

Please Log in or Create an account to join the conversation.

  • Posts: 155
  • Thank you received: 2
21 Mar 2013 03:54 #299
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?

Please Log in or Create an account to join the conversation.

  • Aayrl
  • Aayrl's Avatar Topic Author
  • Offline
  • Administrator
  • Administrator
  • Big Deal!
  • Posts: 1118
  • Thank you received: 370
22 Mar 2013 14:06 #300
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

Please Log in or Create an account to join the conversation.

Moderators: Doomblah
Time to create page: 1.532 seconds