Skip to content

MoLang Function Reference

Venture uses MoLang scripting for flexible, data-driven venture creation. This reference documents all available functions, query structures, and scripting capabilities.

Available in all script contexts. Provides access to the player who started the venture.

q.player.name // Player username (String)
q.player.uuid // Player UUID (String)
q.player.tell(message) // Send chat message to player
q.player.tell_minimessage(msg) // Send MiniMessage formatted message
q.run_command(command) // Execute server command
// Example: q.run_command('give ' + q.player.name + ' minecraft:diamond 5')
q.player.pc.find_by_properties(properties)
// Find Pokemon in PC matching Cobblemon property string
// Returns: count of matching Pokemon
// Example: q.player.pc.find_by_properties('species=pikachu shiny')

Available in pokemon_requirements and reward scripts. Provides access to individual Pokémon.

q.pokemon.species.name // Species name (e.g., "Pikachu")
q.pokemon.level // Current level (Integer)
q.pokemon.nickname // Nickname (String, empty if none)
q.pokemon.form // Form name (String)
q.pokemon.ability // Ability name (String)
q.pokemon.gender // Gender string ("MALE", "FEMALE", "NEUTRAL")
q.pokemon.nature // Nature name (String)
q.pokemon.tera_type // Terastal type (String)
q.pokemon.ot // Original Trainer name (String)
q.pokemon.owner_uuid // Owner UUID (String)
// Individual Values (IVs)
q.pokemon.ivs.hp // HP IV (0-31)
q.pokemon.ivs.atk // Attack IV (0-31)
q.pokemon.ivs.def // Defense IV (0-31)
q.pokemon.ivs.spa // Special Attack IV (0-31)
q.pokemon.ivs.spd // Special Defense IV (0-31)
q.pokemon.ivs.spe // Speed IV (0-31)
// Effort Values (EVs)
q.pokemon.evs.hp // HP EV (0-255)
q.pokemon.evs.atk // Attack EV (0-255)
q.pokemon.evs.def // Defense EV (0-255)
q.pokemon.evs.spa // Special Attack EV (0-255)
q.pokemon.evs.spd // Special Defense EV (0-255)
q.pokemon.evs.spe // Speed EV (0-255)
q.pokemon.matches(properties) // Test against Cobblemon property string
// Returns: 1.0 if matches, 0.0 if not
// Example: q.pokemon.matches('type=fire level=50..100')
q.pokemon.has_aspect(aspect) // Check for specific aspect
// Returns: 1.0 if has aspect, 0.0 if not
// Example: q.pokemon.has_aspect('shiny')
q.pokemon.is_type(type) // Check if Pokemon has type
// Returns: 1.0 if has type, 0.0 if not
// Example: q.pokemon.is_type('fire')

Selected Pokémon Context (q.selected_pokemon)

Section titled “Selected Pokémon Context (q.selected_pokemon)”

Available in pokemon_requirements for multi-Pokémon validation.

q.selected_pokemon // Returns array of all currently selected Pokemon
q.selected_pokemon(index) // Access specific Pokemon by index (0-based)
q.selected_pokemon.size // Number of selected Pokemon
// Example: Check if all selected are fire type
for_each(t.pkmn, q.selected_pokemon, {
t.pkmn.is_type('fire') == 0.0 ? return 0.0;
});
return 1.0;

Available in tick_script for accessing venture state.

q.venture_type() // VentureType struct
q.venture_type.id // Venture ID (String)
q.venture_type.name // Venture display name (String)
q.venture_type.duration // Duration in milliseconds (Long)
q.end_time() // End timestamp (milliseconds)
q.elapsed_time() // Milliseconds elapsed since start
q.ticks_elapsed() // Game ticks elapsed (20 ticks = 1 second)
q.venture_level() // Venture level (Integer, currently always 1)
// Single Pokemon (in reward scripts)
q.pokemon(index).add_xp(amount) // Add XP to specific Pokemon
q.pokemon(index).set_xp(amount) // Set total XP
q.pokemon(index).get_xp() // Get current XP
// All Pokemon
q.add_xp_all(amount) // Add XP to all Pokemon in venture
q.set_xp_all(amount) // Set XP for all Pokemon
// Example: Give 200 XP to first Pokemon
q.pokemon(0).add_xp(200);
// Example: Give 100 XP to all
q.add_xp_all(100);
// Single Pokemon
pokemon.set_iv(stat, value) // Set IV for a stat (0-31)
// Stats: "hp", "atk", "def", "spa", "spd", "spe"
// Example: pokemon.set_iv('atk', 31)
// All Pokemon
q.set_iv_all(stat, value) // Set IV for all Pokemon
q.add_iv_all(stat, amount) // Add to IV (clamped to 0-31)
// Example: Set all Attack IVs to 31
q.set_iv_all('atk', 31);
// Example: Add 5 to all Speed IVs
q.add_iv_all('spe', 5);
// Single Pokemon
pokemon.set_ev(stat, value) // Set EV for a stat (0-255, respects 510 total)
// Automatically enforces EV limits
// All Pokemon
q.set_ev_all(stat, value) // Set EV for all Pokemon
q.add_ev_all(stat, amount) // Add to EV (respects limits)
// Example: Set Special Attack EV to 252
pokemon.set_ev('spa', 252);
// Example: Add 10 EVs to all Pokemon's Speed
q.add_ev_all('spe', 10);
pokemon.learn_move(move_id) // Add move to benched moves
// Note: Adds to benched moves, not active moveset
// Example: pokemon.learn_move('earthquake')
pokemon.apply(property_string) // Apply Cobblemon property string
// Can modify species, level, aspects, etc.
// Example: pokemon.apply('level=100 shiny')
q.apply_to_all(property_string) // Apply property to all Pokemon
// Example: q.apply_to_all('level=50')
pokemon.clear_held_item() // Remove held item
q.any_match(expression) // Returns 1.0 if ANY Pokemon matches expression
q.all_match(expression) // Returns 1.0 if ALL Pokemon match expression
// Example: Check if any Pokemon is shiny
q.any_match(q.pokemon.has_aspect('shiny'))
// Example: Check if all Pokemon are level 50+
q.all_match(q.pokemon.level >= 50.0)
for_each(variable, array, { script })
// Execute script for each element in array
// 'variable' is accessible inside the block
// Example: Add XP to each Pokemon
for_each(t.pkmn, q.pokemon, {
t.pkmn.add_xp(200);
q.player.tell(t.pkmn.species.name + ' gained 200 XP!');
});

These functions add lines to requirement tooltips and failure messages.

q.add_requirement(text) // Add requirement line to tooltip
q.append_fail_message(text) // Add failure message when requirement not met
q.add_reward_line(text) // Add reward line to tooltip
// Example: Add requirement with failure message
q.add_requirement('All Pokemon must be level 30+');
q.pokemon.level < 30.0 ? {
q.append_fail_message(q.pokemon.species.name + ' is only level ' + q.pokemon.level);
return 0.0;
};

Store state across tick script executions. Variables persist for the duration of the venture.

v.variable_name // Access/create venture variable
v.variable_name = value // Set variable value
// Example: Track treasure discoveries
v.treasures_found == 0.0 ? v.treasures_found = 0.0; // Initialize
v.treasures_found = v.treasures_found + 1.0; // Increment
// Example: Store item ID
v.item_type = 'minecraft:diamond';

Used for temporary calculations within a single script execution. Reset between executions.

t.temp_value = calculation // Store temporary result
t.result = math.min(a, b) // Use in calculations
// Example: Calculate team size
t.team_size = q.pokemon.size;
t.xp_per_pokemon = 500.0 / t.team_size;
math.random_integer(min, max) // Random integer (inclusive)
math.min(a, b) // Minimum value
math.max(a, b) // Maximum value
math.floor(value) // Round down
math.ceil(value) // Round up
math.sin(value) // Sine function
math.cos(value) // Cosine function
// Example: Random treasure roll
t.roll = math.random_integer(1, 100);
t.roll <= 5.0 ? {
q.player.tell('Found treasure!');
};
q.array(item1, item2, ...) // Create array
array[index] // Access element by index
array.size // Array length
// Example: Random selection
t.options = q.array('diamond', 'emerald', 'gold');
t.index = math.random_integer(0, 2);
t.selected = t.options[t.index];
condition ? true_value : false_value // Ternary operator
// Example: Level-based reward
t.xp_bonus = q.pokemon.level >= 50.0 ? 500.0 : 200.0;
scripts: [
"""
// Give 200 XP to all Pokemon
for_each(t.pkmn, q.pokemon, {
t.pkmn.add_xp(200);
});
"""
]
pokemon_requirements: [
"""
// Require level 30+
q.pokemon.level < 30.0 ? {
q.append_fail_message(q.pokemon.species.name + ' must be level 30+');
return 0.0;
};
// Require fire or water type
t.valid_type = q.pokemon.is_type('fire') || q.pokemon.is_type('water');
t.valid_type == 0.0 ? {
q.append_fail_message('Must be Fire or Water type!');
return 0.0;
};
return 1.0;
"""
]
pokemon_requirements: [
"""
// Count types in selection
t.fire_count = 0.0;
t.water_count = 0.0;
for_each(t.p, q.selected_pokemon, {
t.fire_count = t.p.is_type('fire') ? t.fire_count + 1.0 : t.fire_count;
t.water_count = t.p.is_type('water') ? t.water_count + 1.0 : t.water_count;
});
// Require at least one of each
t.fire_count > 0.0 && t.water_count > 0.0 ? return 1.0 : {
q.append_fail_message('Team must include both Fire and Water types!');
return 0.0;
};
"""
]
tick_script: [
"""
// Initialize treasure counter
v.treasures == 0.0 ? v.treasures = 0.0;
// Check every 10 seconds (200 ticks)
t.time = q.ticks_elapsed;
(t.time % 200) == 0.0 ? {
// 5% chance to find treasure
t.roll = math.random_integer(1, 100);
t.roll <= 5.0 ? {
v.treasures = v.treasures + 1.0;
q.player.tell('<gold>Found treasure #' + v.treasures + '!');
};
};
"""
]
rewards: [
{
type: script
scripts: [
"""
// Give treasures found during venture
t.count = v.treasures;
t.count > 0.0 ? {
q.run_command('give ' + q.player.name + ' minecraft:diamond ' + t.count);
q.player.tell('Received ' + t.count + ' diamonds!');
};
"""
]
}
]
rewards: [
{
type: script
reward_string: "+10 Speed EVs per Pokemon"
scripts: [
"""
for_each(t.pkmn, q.pokemon, {
// Get current Speed EV
t.current = t.pkmn.evs.spe;
// Add 10, cap at 252
t.new_value = math.min(252, t.current + 10.0);
// Apply
t.pkmn.set_ev('spe', t.new_value);
// Notify
q.player.tell(t.pkmn.species.name + ' gained 10 Speed EVs!');
});
"""
]
}
]
  • Use v. for persistent venture state
  • Use t. for temporary calculations
  • Use descriptive names: t.team_size not t.x
  • Always validate before operations
  • Provide clear failure messages
  • Use defensive checks: v.counter == 0.0 ? v.counter = 0.0;
  • Minimize operations in tick_script
  • Use modulo for periodic checks: (q.ticks_elapsed % 100) == 0.0
  • Cache calculated values in temporary variables
  • Use multi-line strings for complex scripts
  • Add comments explaining logic
  • Break complex operations into steps
for_each(t.pkmn, q.pokemon, {
t.pkmn.is_type('fire') ? q.run_command('give ' + q.player.name + ' cobblemon:charcoal');
t.pkmn.is_type('water') ? q.run_command('give ' + q.player.name + ' cobblemon:mystic_water');
});
for_each(t.pkmn, q.pokemon, {
t.base_xp = 100.0;
t.bonus = t.pkmn.level >= 50.0 ? 50.0 : 0.0;
t.pkmn.add_xp(t.base_xp + t.bonus);
});
q.any_match(q.pokemon.has_aspect('shiny')) ? {
q.player.tell('<rainbow>A shiny Pokemon returned!</rainbow>');
q.run_command('give ' + q.player.name + ' cobblemon:shiny_charm');
};
t.high_level_count = 0.0;
for_each(t.p, q.pokemon, {
t.high_level_count = t.p.level >= 75.0 ? t.high_level_count + 1.0 : t.high_level_count;
});
t.high_level_count >= 3.0 ? {
q.run_command('give ' + q.player.name + ' cobblemon:ability_capsule');
q.player.tell('Bonus reward for high-level team!');
};