Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tutoriel:script_shell [Le 20/02/2022, 09:00] – [Les arguments en ligne de commande] 88.170.129.244 | tutoriel:script_shell [Le 18/05/2026, 23:29] (Version actuelle) – [Méthode dans un terminal] typos krodelabestiole | ||
|---|---|---|---|
| Ligne 3: | Ligne 3: | ||
| ---- | ---- | ||
| - | loadstring(game:HttpGet(" | + | ====== Introduction aux scripts shell ====== |
| + | |||
| + | Un script shell permet d' | ||
| + | <code bash> | ||
| + | # | ||
| + | # This script will take an animated GIF and delete every other frame | ||
| + | # Accepts two parameters: input file and output file | ||
| + | # Usage: ./< | ||
| + | |||
| + | # Make a copy of the file | ||
| + | cp " | ||
| + | |||
| + | # Get the number of frames | ||
| + | numframes=$(gifsicle | ||
| + | | grep --perl-regexp --only-matching '\d+ images' | ||
| + | | grep --perl-regexp --only-matching ' | ||
| + | |||
| + | # Deletion | ||
| + | let i=0 | ||
| + | while test $i -lt $numframes | ||
| + | do | ||
| + | rem=$(( $i % 2 )) | ||
| + | |||
| + | if test $rem -eq 0 | ||
| + | then | ||
| + | gifsicle " | ||
| + | fi | ||
| + | |||
| + | let i=i+1 | ||
| + | done | ||
| + | </ | ||
| =====Pour faire qu'un script soit exécutable ===== | =====Pour faire qu'un script soit exécutable ===== | ||
| Ligne 9: | Ligne 39: | ||
| Votre script est un simple fichier texte, par défaut il s' | Votre script est un simple fichier texte, par défaut il s' | ||
| - | Pour qu'il soit autorisé à se lancer en tant que programme, il faut modifier ses propriétés.\\ | + | Pour qu'il soit autorisé à se lancer en tant que programme, il faut modifier ses propriétés. |
| Pour cela faites un clic droit sur son icône, et dans l' | Pour cela faites un clic droit sur son icône, et dans l' | ||
| Ligne 26: | Ligne 56: | ||
| ==== Méthode dans un terminal ==== | ==== Méthode dans un terminal ==== | ||
| - | Il suffit de se placer dans le dossier où est le script, | + | Pour utiliser un |
| - | mais pas toujours bash ( dépend du langage | + | <code bash> |
| + | |||
| + | La commande est à adapter selon l' | ||
| + | <code bash> | ||
| - | ou si vous voulez | + | Grâce au [[# |
| + | Il faut avant tout le rendre exécutable avec '' | ||
| + | Pour ceci entrer | ||
| + | <code bash> | ||
| - | Puis vous pouvez | + | Puis exécuter le script |
| - | mais pourquoi le ./ ? | + | <code bash>./script.sh</ |
| === Le chemin ./ === | === Le chemin ./ === | ||
| - | Il peut être intéressant d'ajouter un répertoire au " | + | Ce ''./'' dépend du [[: |
| - | Je m'explique, quand vous tapez une commande ("ls" | + | |
| - | Pour voir à quoi ressemble | + | === $PATH === |
| + | |||
| + | La [[: | ||
| + | |||
| + | En plaçant un fichier exécutable (comme un script) dans l'un de ces répertoires, | ||
| + | Ubuntu dispose d'un répertoire des [[: | ||
| + | |||
| + | Pour voir à quoi ressemble | ||
| echo $PATH | echo $PATH | ||
| - | Cette commande | + | Cette commande |
| / | / | ||
| - | C'est à dire que le shell va aller voir si la définition de la commande tapée (" | + | C'est à dire que le système |
| - | Ajouter | + | On peut aussi ajouter |
| - | Pour pouvoir utiliser mes scripts en tapant directement leur nom (sans le " | + | Pour ceci, il suffit |
| - | Pour ceci, il suffit | + | |
| export PATH=$PATH: | export PATH=$PATH: | ||
| + | où '' | ||
| La commande | La commande | ||
| Ligne 57: | Ligne 99: | ||
| / | / | ||
| - | et je peux lancer le script appelé | + | et on peut lancer le script appelé |
| + | | ||
| - | <note tip> | + | <note tip> |
| + | Cette modification du '' | ||
| + | Pour rendre la modification permanente, ajouter | ||
| + | </ | ||
| - | <note important> | + | <note important> |
| + | En l' | ||
| + | </ | ||
| === Les différents types de shells === | === Les différents types de shells === | ||
| - | Comme vous avez sûrement dû l' | + | Il existe différents types de //shells//, ou interpréteurs de commandes : |
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | Il existe encore beaucoup d' | ||
| + | |||
| + | La commande '' | ||
| + | |||
| + | < | ||
| + | On peut aussi écrire des scripts dans d' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * etc. | ||
| + | </ | ||
| - | * [[wpfr> | + | === Shebang === |
| - | * [[:bash]] (//Bourne Again SHell//) : conçu par le projet GNU, shell linux ; le shell par défaut sur Ubuntu ; | + | |
| - | * rbash : un shell restreint basé sur bash. Il existe de nombreuses variantes de bash ; | + | |
| - | * csh, tcsh : shells C, créés par Bill Joy de Berkeley ; | + | |
| - | * zsh, shell C écrit par Paul Falstad ; | + | |
| - | * ksh (<=> ksh88 sur Solaris et équivaut à ksh93 sur les autres UNIX/Linux cf.[[http:// | + | |
| - | * rc : shell C, lui aussi conçu par le projet GNU ; | + | |
| - | * tclsh : shell utilisant Tcl ; | + | |
| - | * wish : shell utilisant Tk . | + | |
| - | Il existe bien entendu beaucoup d' | + | Le [[wpfr> |
| - | La commande **sh** est en fait un lien symbolique vers l'interpréteur | + | Pour '' |
| + | < | ||
| ===== Les variables ===== | ===== Les variables ===== | ||
| - | Il faut savoir | + | Il faut savoir |
| - | Cela dépendra de son USAGE, pour une opération arithmétique prochaine voir : let ma_variable sinon pour conserver une valeur : | + | Cela dépendra de son USAGE, pour une opération arithmétique prochaine voir : let ma_variable sinon pour conserver une valeur : |
| il suffit de lui donner un nom et une valeur avec l' | il suffit de lui donner un nom et une valeur avec l' | ||
| <code bash> | <code bash> | ||
| Ligne 151: | Ligne 215: | ||
| Exemple: un sleep interactif pour illustrer $! (Cf. [[: | Exemple: un sleep interactif pour illustrer $! (Cf. [[: | ||
| - | Pour déclarer un tableau, plusieurs méthodes :\\ | + | Pour déclarer un tableau, plusieurs méthodes : |
| première méthode (compatible bash, zsh, et ksh93 mais pas ksh88, ni avec dash, qui est lancé par " | première méthode (compatible bash, zsh, et ksh93 mais pas ksh88, ni avec dash, qui est lancé par " | ||
| <code bash> | <code bash> | ||
| Ligne 185: | Ligne 249: | ||
| renverront la même réponse. | renverront la même réponse. | ||
| - | NB2 : les tableaux sont séparés par un séparateur défini : l'IFS. | + | NB2 : les tableaux sont séparés par un séparateur défini : l' |
| - | Par défaut l'IFS est composé des trois caractères : $' \t\n' soit espace, tabulation, saut de ligne. | + | Par défaut l'IFS est composé des trois caractères : $' \t\n' soit espace, tabulation, saut de ligne. |
| Il peut être forcé sur un autre caractère. | Il peut être forcé sur un autre caractère. | ||
| <code bash> | <code bash> | ||
| Ligne 194: | Ligne 258: | ||
| * un caractère spécial : ($' | * un caractère spécial : ($' | ||
| - | --[[ | + | ==== Les arguments en ligne de commande ==== |
| - | Change logs: | + | |
| - | 1/14/22 | + | Pour passer des arguments en ligne de commande c'est encore une fois très simple. Chaque argument est numéroté et ensuite on l' |
| - | * first update of the new year! | + | |
| - | * added a settings saving / loading system. | + | |
| - | * added some save manager code for this ui library, not all option types are supported or tested. | + | |
| - | 12/5/21 | + | ./test.sh powa noplay |
| - | * Fixed issues with noteTime calculation, | + | |
| - | 11/9/21 | + | Voici notre test.sh |
| - | + Added support for new modes (9Key for example) | + | <code bash> |
| + | #!/bin/sh | ||
| + | echo $3 | ||
| + | echo $2 | ||
| + | </ | ||
| - | 9/26/21 | + | Notez que $0 est le nom du fichier. |
| - | + Added ' | + | |
| - | * Fixed issues with accuracy. | + | |
| - | 9/ | + | '' |
| - | * Added a few sanity checks | + | |
| - | * Fixed some errors | + | |
| - | * Should finally fix invisible notes (if it doesnt, i hate this game) | + | |
| - | 9/25/21 | + | Voici un exemple de script où vous devez vous souvenir de ce que vous avez écrit |
| - | * Code refactoring. | + | <code bash> |
| - | * Fixed unsupported exploit check | + | #!/bin/sh |
| - | * Implemented safer URL loading routine. | + | clear # Un peu facile si la commande reste au dessus |
| - | * Tweaked autoplayer | + | until [ $# = 0 ] |
| - | + | do | |
| - | 9/19/21 | + | |
| - | * Miss actually ignores the note. | + | read Reslt |
| - | + | if [ "$Reslt" = "$1" ]; then | |
| - | 8/20/21 | + | |
| - | ! This update was provided by Sezei (https://github.com/ | + | else |
| - | * I renamed some stuff and changed their default ' | + | |
| - | + | | |
| - | + Added 'Miss chance' | + | |
| - | + Added ' | + | |
| - | + Added ' | + | fi |
| - | * Added new credits | + | |
| - | * Made folder names more clear | + | done |
| - | + | echo "Vous avez réussi | |
| - | 8/2/21 | + | </code> |
| - | ! KRNL has since been fixed, enjoy! | + | |
| - | + | ||
| - | + Added ' | + | |
| - | * Switched fastWait and fastSpawn to Roblox' | + | |
| - | * Attempted to fix ' | + | |
| - | + | ||
| - | 5/12/21 | + | |
| - | * Attempted to fix the autoplayer missing as much. | + | |
| - | + | ||
| - | 5/16/21 | + | |
| - | * Attempt to fix invisible notes. | + | |
| - | * Added hit chances & an autoplayer toggle | + | |
| - | ! Hit chances are a bit rough but should work. | + | |
| - | + | ||
| - | Information: | + | |
| - | Officially supported: Synapse X, Script-Ware, KRNL, Fluxus | + | |
| - | Needed functions: setthreadcontext, | + | |
| - | + | ||
| - | You can find contact information on the GitHub repository (https:// | + | |
| - | --]] | + | |
| - | + | ||
| - | local start = tick() | + | |
| - | local client = game: | + | |
| - | local set_identity = (type(syn) == ' | + | |
| - | + | ||
| - | local function fail(r) return client: | + | |
| - | + | ||
| - | -- gracefully handle errors when loading external scripts | + | |
| - | -- added a cache to make hot reloading a bit faster | + | |
| - | + | ||
| - | local usedCache = shared.__urlcache and next(shared.__urlcache) ~= nil | + | |
| - | + | ||
| - | shared.__urlcache = shared.__urlcache or {} | + | |
| - | local function urlLoad(url) | + | |
| - | local success, result | + | |
| - | + | ||
| - | if shared.__urlcache[url] then | + | |
| - | success, result | + | |
| - | | + | |
| - | success, result = pcall(game.HttpGet, | + | |
| - | end | + | |
| - | + | ||
| - | if (not success) then | + | |
| - | return fail(string.format(' | + | |
| - | end | + | |
| - | + | ||
| - | local fn, err = loadstring(result) | + | |
| - | if (type(fn) ~= ' | + | |
| - | return fail(string.format(' | + | |
| - | end | + | |
| - | + | ||
| - | local results = { pcall(fn) } | + | |
| - | if (not results[1]) then | + | |
| - | return fail(string.format(' | + | |
| - | end | + | |
| - | + | ||
| - | shared.__urlcache[url] = result | + | |
| - | return unpack(results, | + | |
| - | end | + | |
| - | + | ||
| - | -- attempt to block imcompatible exploits | + | |
| - | -- rewrote because old checks literally did not work | + | |
| - | if type(set_identity) ~= ' | + | |
| - | if type(getconnections) ~= ' | + | |
| - | if type(getloadedmodules) ~= ' | + | |
| - | if type(getgc) ~= ' | + | |
| - | + | ||
| - | local library | + | |
| - | local akali = urlLoad(" | + | |
| - | + | ||
| - | local httpService = game: | + | |
| - | + | ||
| - | local framework, scrollHandler | + | |
| - | local counter = 0 | + | |
| - | + | ||
| - | while true do | + | |
| - | for _, obj in next, getgc(true) do | + | |
| - | if type(obj) == ' | + | |
| - | framework = obj; | + | |
| - | break | + | |
| - | end | + | |
| - | end | + | |
| - | + | ||
| - | for _, module in next, getloadedmodules() do | + | |
| - | if module.Name == ' | + | |
| - | scrollHandler = module; | + | |
| - | break; | + | |
| - | end | + | |
| - | end | + | |
| - | + | ||
| - | if (type(framework) == ' | + | |
| - | break | + | |
| - | end | + | |
| - | + | ||
| - | counter = counter + 1 | + | |
| - | if counter > 6 then | + | |
| - | fail(string.format(' | + | |
| - | end | + | |
| - | wait(1) | + | |
| - | end | + | |
| - | + | ||
| - | local runService = game: | + | |
| - | local userInputService = game: | + | |
| - | local virtualInputManager = game: | + | |
| - | + | ||
| - | local random = Random.new() | + | |
| - | + | ||
| - | local task = task or getrenv().task; | + | |
| - | local fastWait, fastSpawn = task.wait, task.spawn; | + | |
| - | + | ||
| - | -- firesignal implementation | + | |
| - | -- hitchance rolling | + | |
| - | local fireSignal, rollChance do | + | |
| - | -- updated for script-ware or whatever | + | |
| - | -- attempted to update for krnl | + | |
| - | + | ||
| - | function fireSignal(target, | + | |
| - | -- getconnections with InputBegan / InputEnded does not work without setting Synapse to the game's context level | + | |
| - | set_identity(2) | + | |
| - | local didFire = false | + | |
| - | for _, signal in next, getconnections(signal) do | + | |
| - | if type(signal.Function) == ' | + | |
| - | local scr = rawget(getfenv(signal.Function), | + | |
| - | if scr == target then | + | |
| - | didFire = true | + | |
| - | pcall(signal.Function, | + | |
| - | end | + | |
| - | end | + | |
| - | end | + | |
| - | -- if not didFire then fail"couldnt fire input signal" | + | |
| - | set_identity(7) | + | |
| - | end | + | |
| - | + | ||
| - | -- uses a weighted random system | + | |
| - | -- its a bit scuffed rn but it works good enough | + | |
| - | + | ||
| - | function rollChance() | + | |
| - | if (library.flags.autoPlayerMode == ' | + | |
| - | if (library.flags.sickHeld) then return ' | + | |
| - | if (library.flags.goodHeld) then return ' | + | |
| - | if (library.flags.okayHeld) then return ' | + | |
| - | if (library.flags.missHeld) then return ' | + | |
| - | + | ||
| - | return ' | + | |
| - | end | + | |
| - | + | ||
| - | local chances = { | + | |
| - | { type = ' | + | |
| - | { type = ' | + | |
| - | { type = ' | + | |
| - | { type = ' | + | |
| - | { type = ' | + | |
| - | } | + | |
| - | + | ||
| - | table.sort(chances, | + | |
| - | return a.value > b.value | + | |
| - | end) | + | |
| - | + | ||
| - | local sum = 0; | + | |
| - | for i = 1, #chances do | + | |
| - | sum += chances[i].value | + | |
| - | end | + | |
| - | + | ||
| - | if sum == 0 then | + | |
| - | -- forgot to change this before? | + | |
| - | -- fixed 6/5/21 | + | |
| - | + | ||
| - | return chances[random: | + | |
| - | end | + | |
| - | + | ||
| - | local initialWeight = random: | + | |
| - | local weight = 0; | + | |
| - | + | ||
| - | for i = 1, #chances do | + | |
| - | weight = weight + chances[i].value | + | |
| - | + | ||
| - | if weight > initialWeight | + | |
| - | return chances[i].type | + | |
| - | end | + | |
| - | end | + | |
| - | + | ||
| - | return ' | + | |
| - | | + | |
| - | end | + | |
| - | + | ||
| - | + | ||
| - | local function notify(text, | + | |
| - | return akali.Notify({ | + | |
| - | Title = 'Funky friday autoplayer', | + | |
| - | Description = text, | + | |
| - | Duration = duration or 1, | + | |
| - | }) | + | |
| - | end | + | |
| - | + | ||
| - | library.notify = notify | + | |
| - | + | ||
| - | -- save manager | + | |
| - | local saveManager = {} do | + | |
| - | local defaultSettings = [[{"Funky Friday": | + | |
| - | local optionTypes = { | + | |
| - | toggle = { | + | |
| - | Save = function(option) | + | |
| - | return { type = ' | + | |
| - | end, | + | |
| - | Load = function(option, | + | |
| - | option: | + | |
| - | end | + | |
| - | }, | + | |
| - | bind = { | + | |
| - | Save = function(option) | + | |
| - | return { type = ' | + | |
| - | end, | + | |
| - | Load = function(option, | + | |
| - | option: | + | |
| - | end | + | |
| - | }, | + | |
| - | slider = { | + | |
| - | Save = function(option) | + | |
| - | return { type = ' | + | |
| - | end, | + | |
| - | Load = function(option, | + | |
| - | option: | + | |
| - | end, | + | |
| - | }, | + | |
| - | color = { | + | |
| - | Save = function(option) | + | |
| - | return { type = ' | + | |
| - | end, | + | |
| - | Load = function(option, | + | |
| - | option: | + | |
| - | end | + | |
| - | }, | + | |
| - | list = { | + | |
| - | Save = function(option) | + | |
| - | return { type = ' | + | |
| - | end, | + | |
| - | Load = function(option, | + | |
| - | option: | + | |
| - | end | + | |
| - | }, | + | |
| - | } | + | |
| - | + | ||
| - | local function recurseLibraryOptions(root, | + | |
| - | for _, option in next, root do | + | |
| - | if option.type == ' | + | |
| - | recurseLibraryOptions(option.options, | + | |
| - | | + | |
| - | callback(option) | + | |
| - | end | + | |
| - | end | + | |
| - | | + | |
| - | + | ||
| - | function saveManager: | + | |
| - | local data = {} | + | |
| - | + | ||
| - | for _, window in next, library.windows do | + | |
| - | if window.title == ' | + | |
| - | + | ||
| - | local storage = {} | + | |
| - | data[window.title] = storage | + | |
| - | + | ||
| - | recurseLibraryOptions(window.options, | + | |
| - | local parser = optionTypes[option.type] | + | |
| - | if parser then | + | |
| - | storage[option.flag] = parser.Save(option) | + | |
| - | end | + | |
| - | end) | + | |
| - | end | + | |
| - | + | ||
| - | local s, err = pcall(writefile, | + | |
| - | if not s then | + | |
| - | library.notify(string.format(' | + | |
| - | if err == ' | + | |
| - | library.notify(' | + | |
| - | end | + | |
| - | return | + | |
| - | end | + | |
| - | + | ||
| - | library.refreshConfigs() | + | |
| - | end | + | |
| - | + | ||
| - | function saveManager: | + | |
| - | local data | + | |
| - | if name == ' | + | |
| - | data = defaultSettings | + | |
| - | else | + | |
| - | data = readfile(' | + | |
| - | end | + | |
| - | + | ||
| - | local success, data = pcall(function() return httpService: | + | |
| - | if not success then | + | |
| - | return library.notify(string.format(' | + | |
| - | end | + | |
| - | + | ||
| - | for _, window in next, library.windows do | + | |
| - | if window.title == ' | + | |
| - | + | ||
| - | local storage = data[window.title] | + | |
| - | if not storage then continue end | + | |
| - | + | ||
| - | recurseLibraryOptions(window.options, | + | |
| - | local parser = optionTypes[option.type] | + | |
| - | if parser then | + | |
| - | parser.Load(option, | + | |
| - | end | + | |
| - | end) | + | |
| - | end | + | |
| - | end | + | |
| - | + | ||
| - | end | + | |
| - | + | ||
| - | -- autoplayer | + | |
| - | local chanceValues do | + | |
| - | chanceValues = { | + | |
| - | Sick = 96, | + | |
| - | Good = 92, | + | |
| - | Ok = 87, | + | |
| - | Bad = 75, | + | |
| - | } | + | |
| - | + | ||
| - | local keyCodeMap = {} | + | |
| - | for _, enum in next, Enum.KeyCode: | + | |
| - | keyCodeMap[enum.Value] = enum | + | |
| - | end | + | |
| - | + | ||
| - | if shared._unload then | + | |
| - | pcall(shared._unload) | + | |
| - | end | + | |
| - | + | ||
| - | library.threads = {} | + | |
| - | function shared._unload() | + | |
| - | if shared._id then | + | |
| - | pcall(runService.UnbindFromRenderStep, | + | |
| - | end | + | |
| - | + | ||
| - | if library.open then | + | |
| - | library: | + | |
| - | end | + | |
| - | + | ||
| - | library.base: | + | |
| - | library.base: | + | |
| - | + | ||
| - | for i = 1, # | + | |
| - | coroutine.close(library.threads[i]) | + | |
| - | end | + | |
| - | | + | |
| - | + | ||
| - | shared._id = httpService: | + | |
| - | runService: | + | |
| - | if (not library.flags.autoPlayer) then return end | + | |
| - | if typeof(framework.SongPlayer.CurrentlyPlaying) ~= ' | + | |
| - | if framework.SongPlayer.CurrentlyPlaying.ClassName ~= ' | + | |
| - | + | ||
| - | local arrows = {} | + | |
| - | for _, obj in next, framework.UI.ActiveSections do | + | |
| - | arrows[#arrows + 1] = obj; | + | |
| - | end | + | |
| - | + | ||
| - | local count = framework.SongPlayer: | + | |
| - | local mode = count .. ' | + | |
| - | + | ||
| - | local arrowData = framework.ArrowData[mode].Arrows | + | |
| - | + | ||
| - | for idx = 1, #arrows do | + | |
| - | local arrow = arrows[idx] | + | |
| - | if type(arrow) ~= ' | + | |
| - | continue | + | |
| - | end | + | |
| - | + | ||
| - | local ignoredNoteTypes = { Death = true, ['Pea Note'] = true } | + | |
| - | + | ||
| - | if type(arrow.NoteDataConfigs) == ' | + | |
| - | if ignoredNoteTypes[arrow.NoteDataConfigs.Type] then | + | |
| - | continue | + | |
| - | end | + | |
| - | end | + | |
| - | + | ||
| - | if (arrow.Side == framework.UI.CurrentSide) and (not arrow.Marked) and framework.SongPlayer.CurrentlyPlaying.TimePosition > 0 then | + | |
| - | local indice = (arrow.Data.Position % count) | + | |
| - | local position = indice .. '' | + | |
| - | + | ||
| - | if (position) then | + | |
| - | local hitboxOffset = 0 do | + | |
| - | local settings = framework.Settings; | + | |
| - | local offset = type(settings) == ' | + | |
| - | local value = type(offset) == ' | + | |
| - | + | ||
| - | if type(value) == ' | + | |
| - | hitboxOffset = value; | + | |
| - | end | + | |
| - | + | ||
| - | hitboxOffset = hitboxOffset / 1000 | + | |
| - | end | + | |
| - | + | ||
| - | local songTime = framework.SongPlayer.CurrentTime do | + | |
| - | local configs = framework.SongPlayer.CurrentSongConfigs | + | |
| - | local playbackSpeed = type(configs) == ' | + | |
| - | + | ||
| - | if type(playbackSpeed) ~= ' | + | |
| - | playbackSpeed = 1 | + | |
| - | end | + | |
| - | + | ||
| - | songTime = songTime / playbackSpeed | + | |
| - | end | + | |
| - | + | ||
| - | local noteTime = math.clamp((1 | + | |
| - | + | ||
| - | local result = rollChance() | + | |
| - | arrow._hitChance = arrow._hitChance or result; | + | |
| - | + | ||
| - | local hitChance = (library.flags.autoPlayerMode == ' | + | |
| - | if hitChance ~= "Miss" and noteTime >= chanceValues[arrow._hitChance] then | + | |
| - | fastSpawn(function() | + | |
| - | arrow.Marked = true; | + | |
| - | local keyCode = keyCodeMap[arrowData[position].Keybinds.Keyboard[1]] | + | |
| - | + | ||
| - | if library.flags.secondaryPressMode then | + | |
| - | virtualInputManager: | + | |
| - | else | + | |
| - | fireSignal(scrollHandler, | + | |
| - | end | + | |
| - | + | ||
| - | if arrow.Data.Length > 0 then | + | |
| - | fastWait(arrow.Data.Length + (library.flags.heldDelay / 1000)) | + | |
| - | else | + | |
| - | fastWait(library.flags.autoDelay / 1000) | + | |
| - | end | + | |
| - | + | ||
| - | if library.flags.secondaryPressMode then | + | |
| - | virtualInputManager: | + | |
| - | else | + | |
| - | fireSignal(scrollHandler, | + | |
| - | end | + | |
| - | + | ||
| - | arrow.Marked = nil; | + | |
| - | end) | + | |
| - | end | + | |
| - | end | + | |
| - | end | + | |
| - | end | + | |
| - | end) | + | |
| - | end | + | |
| - | + | ||
| - | -- menu | + | |
| - | + | ||
| - | local windows = { | + | |
| - | autoplayer = library: | + | |
| - | customization = library: | + | |
| - | configs = library: | + | |
| - | misc = library: | + | |
| - | } | + | |
| - | + | ||
| - | local folder = windows.autoplayer: | + | |
| - | local toggle = folder: | + | |
| - | + | ||
| - | folder: | + | |
| - | if library.flags.secondaryPressMode then | + | |
| - | library.notify(' | + | |
| - | end | + | |
| - | end }) -- alternate mode if something breaks on krml or whatever | + | |
| - | folder: | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | end }) | + | |
| - | + | ||
| - | folder: | + | |
| - | folder: | + | |
| - | end | + | |
| - | + | ||
| - | local folder = windows.customization: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | end | + | |
| - | + | ||
| - | local folder = windows.customization: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | end | + | |
| - | + | ||
| - | local folder = windows.customization: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | end | + | |
| - | + | ||
| - | if type(readfile) == ' | + | |
| - | if not isfolder(' | + | |
| - | makefolder(' | + | |
| - | makefolder(' | + | |
| - | end | + | |
| - | + | ||
| - | local window = windows.configs do | + | |
| - | window: | + | |
| - | library._configList = window: | + | |
| - | + | ||
| - | window: | + | |
| - | local name = library.flags.configNameInput | + | |
| - | if name: | + | |
| - | return notify(' | + | |
| - | end | + | |
| - | + | ||
| - | saveManager: | + | |
| - | end }) | + | |
| - | + | ||
| - | window: | + | |
| - | local name = library.flags.configList | + | |
| - | + | ||
| - | if name: | + | |
| - | return notify(' | + | |
| - | end | + | |
| - | + | ||
| - | if not isfile(' | + | |
| - | return notify(' | + | |
| - | end | + | |
| - | + | ||
| - | saveManager: | + | |
| - | end }) | + | |
| - | + | ||
| - | window: | + | |
| - | + | ||
| - | function library.refreshConfigs() | + | |
| - | for _, value in next, library._configList.values do | + | |
| - | if value == ' | + | |
| - | library._configList: | + | |
| - | end | + | |
| - | + | ||
| - | local files = listfiles(' | + | |
| - | for i = 1, #files do | + | |
| - | | + | |
| - | | + | |
| - | end | + | |
| - | + | ||
| - | if files[1] then | + | |
| - | library._configList: | + | |
| - | else | + | |
| - | library._configList: | + | |
| - | end | + | |
| - | end | + | |
| - | + | ||
| - | window: | + | |
| - | end | + | |
| - | task.delay(1, | + | |
| - | else | + | |
| - | notify(' | + | |
| - | end | + | |
| - | + | ||
| - | local folder = windows.misc: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | folder: | + | |
| - | end | + | |
| - | + | ||
| - | windows.misc: | + | |
| - | windows.misc: | + | |
| - | windows.misc: | + | |
| - | + | ||
| - | windows.misc: | + | |
| - | windows.misc: | + | |
| - | shared._unload() | + | |
| - | library.notify(' | + | |
| - | end }) | + | |
| - | + | ||
| - | windows.misc: | + | |
| - | if pcall(setclipboard, | + | |
| - | library.notify(' | + | |
| - | end | + | |
| - | end }) | + | |
| - | + | ||
| - | windows.misc: | + | |
| - | windows.misc: | + | |
| - | library: | ||
| - | library.notify(string.format(' | ||
| ==== L' | ==== L' | ||
| <code bash>(( variable = 2 + $autre_var * 5 ))</ | <code bash>(( variable = 2 + $autre_var * 5 ))</ | ||
| Exemple: besoin de définir des plages de valeurs (1 à 500 puis 501 à 1000 puis 1001 à 1500…) | Exemple: besoin de définir des plages de valeurs (1 à 500 puis 501 à 1000 puis 1001 à 1500…) | ||
| <code bash> | <code bash> | ||
| - | id_per_step = 500 | + | id_per_step=500 |
| for (( i=0; i<8; i++ )); do | for (( i=0; i<8; i++ )); do | ||
| (( min_step_id = 1 + $i * $id_per_step )) | (( min_step_id = 1 + $i * $id_per_step )) | ||
| Ligne 839: | Ligne 318: | ||
| ^ Syntaxe ^ Fonction réalisée ^ | ^ Syntaxe ^ Fonction réalisée ^ | ||
| - | | -e fichier | + | | -e fichier |
| - | | -d fichier | + | | -d répertoire |
| - | | -f fichier | + | | -f fichier |
| - | | -w fichier | + | | -w fichier |
| - | | -x fichier | + | | -x fichier |
| - | | f1 -nt f2 | + | | f1 -nt f2 |
| - | | f1 -ot f2 | + | | f1 -ot f2 |
| + | <note tip>Si vous préférez vérifier que votre // | ||
| === Opérateurs de comparaison numérique === | === Opérateurs de comparaison numérique === | ||
| Ligne 945: | Ligne 425: | ||
| fi | fi | ||
| </ | </ | ||
| + | <note tip> | ||
| + | Les crochets simples [] correspondent à des tests de condition conformes au shell POSIX.\\ | ||
| + | Les doubles permettent d' | ||
| + | Préférez les crochets simples pour une meilleure compatibilité. | ||
| + | </ | ||
| === Explication === | === Explication === | ||
| Ligne 1249: | Ligne 733: | ||
| </ | </ | ||
| | | ||
| - | Comme vous l'avez sans doute remarqué, quand on appelle la fonction, on exécute simplement ce qu'on lui a défini au début, dans notre exemple, echo... et ls -l, on peut donc faire exécuter n' | + | Comme vous l'avez sans doute remarqué, quand on appelle la fonction, on exécute simplement ce qu'on lui a défini au début, dans notre exemple, echo... et ls -l, on peut donc faire exécuter n' |
| Les fonctions peuvent être définies n' | Les fonctions peuvent être définies n' | ||
| Ligne 1386: | Ligne 870: | ||
| ===== Exemples et exercices ===== | ===== Exemples et exercices ===== | ||
| - | Comme indiqué dans la [[script_shell# | + | Comme indiqué dans la [[script_shell# |
| - | [[http:// | + | [[https:// |
| Aux structures décrites ci-dessus, il est nécessaire, | Aux structures décrites ci-dessus, il est nécessaire, | ||
| - | La programmation de script shell étant ouverte à tous, cela permet de bénéficier de nombreux scripts pour des applications très variées ; cependant, **la plupart sont proposés sans aucune garantie**.\\ | + | La programmation de script shell étant ouverte à tous, cela permet de bénéficier de nombreux scripts pour des applications très variées ; cependant, **la plupart sont proposés sans aucune garantie**. |
| Vous pourrez trouver une liste de scripts pouvant servir d' | Vous pourrez trouver une liste de scripts pouvant servir d' | ||
| - | Une fois vos armes faites, proposez vos contributions sur le topic du forum [[http:// | + | Une fois vos armes faites, proposez vos contributions sur le topic du forum [[https:// |
| ===== L'art d' | ===== L'art d' | ||
| Ligne 1445: | Ligne 929: | ||
| ===== Liens ===== | ===== Liens ===== | ||
| - | * (fr) http:// | + | * (fr) https:// |
| - | * (fr) [[http:// | + | * (fr) [[https:// |
| * (fr) https:// | * (fr) https:// | ||
| * (en) [[http:// | * (en) [[http:// | ||
| * (fr ) [[ftp:// | * (fr ) [[ftp:// | ||
| - | * (fr ) [[http:// | + | * (fr ) [[http:// |
| * (en) [[https:// | * (en) [[https:// | ||
