Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Aug 10, 2013 21:54:52 GMT
OK, thanks!
|
|
|
Post by Jeff on Aug 11, 2013 0:14:41 GMT
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 =)
|
|
Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Aug 11, 2013 18:23:38 GMT
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.
|
|
|
Post by Jeff on Aug 11, 2013 22:00:10 GMT
just fyi onMissionReset is used for your scratched out part.
and ah okay.
|
|
main_gi
Intermediate Marbler
Solving a Rubik's cube in less than [s]2[/s]1 minute[s]s[/s].
Posts: 83
|
Post by main_gi on Aug 12, 2013 22:31:11 GMT
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.
|
|
|
Post by Jeff on Aug 12, 2013 22:32:07 GMT
1. it just forces the marble to go in its opposite spin direction, so applies a negative angular velocity?? I think.
2. what?
|
|
main_gi
Intermediate Marbler
Solving a Rubik's cube in less than [s]2[/s]1 minute[s]s[/s].
Posts: 83
|
Post by main_gi on Aug 12, 2013 22:46:32 GMT
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)
|
|
|
Post by Jeff on Aug 12, 2013 23:40:18 GMT
yeah because it reverses the reversed angular velocity.
|
|
|
Post by Alexis on Aug 16, 2013 19:23:50 GMT
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
|
|
|
Post by Jeff on Aug 16, 2013 19:51:23 GMT
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
|
|
|
Post by Alexis on Aug 16, 2013 19:56:34 GMT
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. How? It doesn't wait for the specified time to read the next line of code... Thanks anyway
|
|
|
Post by Jeff on Aug 16, 2013 20:00:16 GMT
from MBElite:
// 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);
|
|
|
Post by Alexis on Aug 16, 2013 20:03:40 GMT
Thank you, Jeff! I will try it
|
|
davidjl123
Professional Marbler
davidjl123
Posts: 383
|
Post by davidjl123 on Aug 19, 2013 1:06:05 GMT
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!"
|
|
|
Post by Jeff on Aug 19, 2013 3:08:30 GMT
marble/client/scripts/game.cs
iirc function name is:
reformatGameEndText
|
|
davidjl123
Professional Marbler
davidjl123
Posts: 383
|
Post by davidjl123 on Aug 19, 2013 3:15:09 GMT
Thanks!
|
|
whirligig
Experienced Marbler
[ss:Phil'sEmpire Skin]
Posts: 168
|
Post by whirligig on Aug 23, 2013 15:57:17 GMT
@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.
|
|
|
Post by LegoCreator768 on Aug 25, 2013 19:34:52 GMT
How do you make gravity buttons (ratios)?
Example: O = a ratio
Gravity
O Low O Normal O High
|
|
whirligig
Experienced Marbler
[ss:Phil'sEmpire Skin]
Posts: 168
|
Post by whirligig on Aug 26, 2013 13:57:53 GMT
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).
|
|
|
Post by LegoCreator768 on Sept 2, 2013 15:28:31 GMT
Another question: how do you male items (gems, power ups) have particle effects?
|
|
|
Post by Jeff on Sept 2, 2013 18:59:15 GMT
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.
|
|
|
Post by LegoCreator768 on Sept 2, 2013 19:17:41 GMT
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?
|
|
|
Post by Jeff on Sept 2, 2013 21:24:31 GMT
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.
|
|
|
Post by LegoCreator768 on Sept 3, 2013 1:48:50 GMT
Thanks for all the help
|
|
Marblemaster1 (Frosty)
Professional Marbler
Master of the Spam Board, that is[ss:Default Skin]
I have CDO. It's just like OCD, except the letters are in alphabetical order AS THEY SHOULD BE.
Posts: 361
|
Post by Marblemaster1 (Frosty) on Dec 22, 2013 0:29:37 GMT
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?
|
|
|
Post by Jeff on Dec 22, 2013 3:42:59 GMT
%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);
|
|