file Basic Marble Blast Coding Q&A

  • Marblemaster1
  • Marblemaster1's Avatar
  • Offline
  • Advanced Marbler
  • Advanced Marbler
  • Custom Code Enthusiast
  • Posts: 237
  • Thank you received: 8
10 Aug 2013 23:54 #331
OK, thanks!

QuArK is still a good map editor

You know what's boring? Opaque marble skins. You know what's not? Glass Marbles!

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
11 Aug 2013 02:14 #332
Aug 10, 2013, 11:15am, marblemaster1 wrote:I have a question.

Suppose I wanted to add on to the onMissionLoaded function in MBP, but only in one MIS file. You can do this in Java by using super(), but can you do it in TS? And if so, how?

No problem.

I want to also point out that this is an awesome way of asking for a coding question, when comparing it to another language. (Mind you I know c++, Java, VB, TS, PHP)

Thank you for asking it well. I was able to answer it right away =)

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.

  • Marblemaster1
  • Marblemaster1's Avatar
  • Offline
  • Advanced Marbler
  • Advanced Marbler
  • Custom Code Enthusiast
  • Posts: 237
  • Thank you received: 8
11 Aug 2013 20:23 #333
Heh, no problem. I've always been better at pure coding languages (C++, java, etc.) than scripting (TS, python...). Don't ask why.

Also, on a related note, is onMissionLoaded called whenever the marble goes OOB and respawns, or just when you click the Play button in the menu and the marble spawns for the first time?

Nvm, I figured it out.

QuArK is still a good map editor

You know what's boring? Opaque marble skins. You know what's not? Glass Marbles!

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
12 Aug 2013 00:00 #334
just fyi onMissionReset is used for your scratched out part.

and ah okay.

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: 148
  • Thank you received: 31
13 Aug 2013 00:31 #335
Not really a coding question as much as being curious:

Why does the Random Force (fric: -1, res: 1) do the random force, and go in one direction?
Also the phenomenon of the jump and go forward thing.

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 Aug 2013 00:32 #336
1. it just forces the marble to go in its opposite spin direction, so applies a negative angular velocity?? I think.

2. what?

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: 148
  • Thank you received: 31
13 Aug 2013 00:46 #337
To avoid the random force, you can jump and hold W (or W+A/W+D) to go in that direction.
(it also works going backwards)

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 Aug 2013 01:40 #338
yeah because it reverses the reversed angular velocity.

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
16 Aug 2013 21:23 #339
Hey, i've been coding some stuff for some days and i have some questions.

1. How to put the informations of a mission (e.g the description) into a variable (only with the .mis directory)?

2. What are the arguments of the moveMap.bindCmd functions? Especially the third one since i had to leave it empty to make my code works.

3. What is the function to end a game? (e.g disconnect(); but it send you to the playMissionGui, is there any function that will just destroy the game?

4. Why can i call the loadMission(); function while playing a mission without making the game crashes like the doCreateGame(); does?

5. Is there any function that makes a delay (the schedule function actually don't wait the specified time to read the next line).

6. What does the tickPeriodMS = 100; stands for in the trigger.cs file?

Thanks

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
16 Aug 2013 21:51 #340
1. %blah = MissionInfo.desc; mis directory loop through files and create a new file object, and read it.

2. leave it blank, idunno but you shouldn't need it

3. modify disconnectCleanup() to not send you there (serverconnection.cs)

4. docreateGame IIRC creates a server, loadmission doesn't.

5. you have to use schedule

6. interval of the onTick() callback is called when an object is inside of the trigger

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
16 Aug 2013 21:56 #341
Aug 16, 2013, 2:51pm, jeff wrote:1. %blah = MissionInfo.desc; mis directory loop through files and create a new file object, and read it.
It's only working when the mis is loaded, i'd like to use it for a GUI.


Aug 16, 2013, 2:51pm, jeff wrote:you have to use schedule
How? It doesn't wait for the specified time to read the next line of code...

Thanks anyway

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
16 Aug 2013 22:00 #342
from MBElite:

Code:// Jeff: grab mission info
function getMissionInfo(%file) {
%fo = new FileObject();
%inInfoBlock = false;
%egg = false;
%gems = 0;
%info = ;
if (%fo.openForRead(%file)) {
while (!%fo.isEOF()) {
%line = trim(%fo.readLine());
if ((!%inInfoBlock) && (strStr(%line,new ScriptObject(MissionInfo) {) != -1)) {
%info = new ScriptObject() {;
%inInfoBlock = true;
continue;
} else if ((%inInfoBlock) && (strStr(%line, };) != -1)) {
%info = %info NL %line;
%inInfoBlock = false;
continue;
} else if (%inInfoBlock) {
%info = %info NL %line;
continue;
}
if (strStr(%line,EasterEgg) != -1) // Jeff: easter egg!
%egg = true;
else if (strStr(%line,Gem) != -1) // Jeff: gems!
%gems ++;
}
%fo.close();
}
%fo.delete();
if (%info $= )
return -1;
eval(%id= @ %info);
if (!isObject(%id))
return -1;
%info = %id.getId();
%info.file = %file;
%info.easterEgg = %egg;
%info.gems = %gems;
%info.schedule(5000,delete);
return %info.getId();
}

usage:

%missionInfo = getMissionInfo(%file);
%desc = %missionInfo.desc;
%artist = %missionInfo.artist;
// ect.

$eventId = schedule(time, 0, function, args);

alternatively for objects:

%obj.event = %obj.schedule(time, 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
16 Aug 2013 22:03 #343
Thank you, Jeff! I will try it

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

  • davidjl123
  • davidjl123's Avatar
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • Posts: 96
  • Thank you received: 0
19 Aug 2013 03:06 #344
How do you modify the name of the times, like if I want to change You have beaten the GOLD time! to You have beaten the LOL 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
19 Aug 2013 05:08 #345
marble/client/scripts/game.cs

iirc function name is:

reformatGameEndText

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.

  • davidjl123
  • davidjl123's Avatar
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • Posts: 96
  • Thank you received: 0
19 Aug 2013 05:15 #346
Thanks!

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

  • whirligig
  • whirligig's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
  • Posts: 444
  • Thank you received: 261
23 Aug 2013 17:57 #347
@Alexis: also, if you're looking for info on a level that shows up in PlayMissionGui, those variables already exist--the group PlayMissionGroup will contain groups of the ScriptObjects for all of your levels, grouped by category (e.g. MTYPE_Beginner has all of the Beginner levels). Each ScriptObject will also have a file field containing the path to the mission file.

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

  • LegoCreator768
  • LegoCreator768's Avatar
  • Offline
  • Experienced Marbler
  • Experienced Marbler
  • Always on technology
  • Posts: 148
  • Thank you received: 19
25 Aug 2013 21:34 #348
How do you make gravity buttons (ratios)?

Example: O = a ratio

Gravity

O Low
O Normal
O High

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

  • whirligig
  • whirligig's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
  • Posts: 444
  • Thank you received: 261
26 Aug 2013 15:57 #349
In the GUI editor or by manually editing a .gui file, you can set a button's buttonType to RadioButton. RadioButton buttons in the same SimGroup will work together (by letting you only press one). There is a GuiRadioCtrl for them, but it looks very generic; I'd recommend using GuiBitmapButtonCtrl if you want to stay in the style of your modification (it will still work as expected). You can use the variable or command fields to grab the input from them (e.g. by setting a different variable for each and testing which is set, or by giving each a command to change the setting).

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

  • LegoCreator768
  • LegoCreator768's Avatar
  • Offline
  • Experienced Marbler
  • Experienced Marbler
  • Always on technology
  • Posts: 148
  • Thank you received: 19
02 Sep 2013 17:28 #350
Another question: how do you male items (gems, power ups) have particle effects?

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
02 Sep 2013 20:59 #351
Sept 2, 2013, 10:28am, legocreator768 wrote:Another question: how do you male items (gems, power ups) have particle effects?

Gems have a gender?!

DISCRIMINATION AGAINST FEMALE GEMS!!!

on a serious note, make custom code and in the gem::onAdd function schedule a particle to spawn. Also please note that coding question and answer does mean in my opinion that you try to make an attempt to code, not entitlement to code.

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.

  • LegoCreator768
  • LegoCreator768's Avatar
  • Offline
  • Experienced Marbler
  • Experienced Marbler
  • Always on technology
  • Posts: 148
  • Thank you received: 19
02 Sep 2013 21:17 #352
oops typo fail I meant to say make. *laughs*

EDIT:

Yet another question(I've got a lot)

I know the basics of particle(changing the colors, sizes) but how do you do the cool stuff like in marble blast fubar?

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
02 Sep 2013 23:24 #353
With magic and editing the particle fields. There isn't much more than editing fields when it comes to particles. See Aayrl's particle guide in the MBDK or Vault MBDK.

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.

  • LegoCreator768
  • LegoCreator768's Avatar
  • Offline
  • Experienced Marbler
  • Experienced Marbler
  • Always on technology
  • Posts: 148
  • Thank you received: 19
03 Sep 2013 03:48 #354
Thanks for all the help

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

  • Marblemaster1
  • Marblemaster1's Avatar
  • Offline
  • Advanced Marbler
  • Advanced Marbler
  • Custom Code Enthusiast
  • Posts: 237
  • Thank you received: 8
22 Dec 2013 03:29 #355
Bump, but I have a question.

Is it possible to return the coordinates of the marble? Such as if I wanted to measure how far the marble has traveled, how would I do that?

QuArK is still a good map editor

You know what's boring? Opaque marble skins. You know what's not? Glass Marbles!

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
22 Dec 2013 06:42 #356
%pos = localClientConnection.player.getPosition();

returns a string x y z

to get each coordinate use the following

%x = getWord(%pos, 0);
%y = getWord(%pos, 1);
%z = getWord(%pos, 2);

if you want the length of the position vector use the following

%length = VectorLen(%pos);

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.

Moderators: Doomblah
Time to create page: 1.942 seconds