Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/07/14 in all areas

  1. Scripting Intermediário! - 1 Olá, meu nome é João Victor vulgo nick é Wolf, e estou criando este tutorial para aprendizado da linguagem script do emulador. São aulas que estavam desatualizadas antigamente no eAthena, que eu me propus a atualizar e adicionar comandos como while, e outros exemplos afim de ajudar a todos da comunidade. Primeiro assunto: - While No inglês o comando While significa enquanto, funciona da mesma forma que um if (verificação). Utilizando condição como base, ele criará um loop (laço) enquanto o valor que estiver nele for verdadeiro, vejamos um exemplo: set @i, 1; while (@i < 100) { mes "Estou aprendendo loopings em Script!"; set @i, @i +1; } Nesse caso, iniciamos o nosso contador que é o While, lembrando que primeiro atribuimos um valor a nossa variável que é igual a 1 (@i). Nosso While avalia se @i é menor que 100, caso for verdadeiro, a condição, ele executará o script, se não for, no caso a condição for falsa, ele sairá do loop (do laço). A primeira volta de nosso loop, a instrução é verdadeira, então dentro do loop escrevemos a mensagem e somamos +1 a variável @i, com o operador de incrementação (+). Após terminar, o loop volta e avalia @i com o vlaor 2, se for verdadeiro, rodará mais uma vez, e assim por diante, até que chegue a seu limite e delimite como falsa, para quebrar o loop. No caso se quisessemos fazer com if, fariamos dessa forma: Retornar: if (@i < 100) { mes "estou aprendendo loops em script!"; set @i, @i +1; callsub Retornar; } Como vimos, o comando while verifica primeiro a variável. Já o comando Do While, que iremos explicar agora, faz ao contrário. Mas porquê? Simples, ele executa o código primeiro, e só depois que verifica a variável, se ela for verdadeira, ele executará o código novamente, e não como o while que verifica primeiro para que depois possa executar ou não o script. Veja o exemplo: set @i, 1; do { mes "Estou aprendendo loops em script!"; set @i, @i +1; } while (@i < 100); Fim da aula de While! Segundo assunto desta aula: - For A sintaxe (comando) for funciona da mesma maneira que o While, em conjunto com um if. Utilizando uma ou mais variáveis como base, junto com uma condição. Ele cria um loop também, enquanto o valor for verdadeiro ele executa, porém em uma linha só, vejamos: for (set @i,1; //Como no While, setamos a variável e seu valor. Agora nesse mesmo For, iremos incrementar a condição, como no While, veja: for (set @i,1; @i <= 100; E como no final, iremos adicionar +1 a variável inicial, para que o for possa contar, até chegar o seu valor condicionalmente definido (100), como abaixo: for (set @i,1; @i <= 100; set @i, @i + 1) Isso não fará do script incorreto, mas se você fizer isso e não souber utilizar corretamente o script, fará um loop inifinito, ou seja, executará o script para sempre, sem que ele pare. Utilizamos desta forma quando o script acaba sendo baseado em uma variável inicial, ou mais variáveis. Veja: for (set @i,1; @i < 100; set @i, @i + 1) { mes "Estou aprendendo loops em script!"; } Neste caso ele executará o mes 100x até o valor 100 ser sanado, batido. Vejamos melhor como funciona, se eu utilizasse um if: set @i, 1; Retornar: if (@i < 100) { mes "Estou aprendendo Loopings em Script!"; set @i, @i + 1; callsub Retornar; } Mas pra que isso, se podemos transformar esse if em apenas uma linha? Veja: for (for set @i,1; @i < 100; set @i, @i +1) { mes "Estou aprendendo Loopings em Script!"; } set @i,0; É o valor inicial da variável base. @i < 100; É a condição para o loop se manter. set @i,@i+1; É o complemento da variável, a incrementação na variável @i, para que a condição seja atingida. Acabamos por aqui nossa primeira aula de script intermediário! Agradeço ao Keoy por ter me ajudado sempre, ser meu professor antigamente e me ensinar muito tudo que sei, e me ter dado aulas com base para criação destes tutoriais.
    1 point
  2. ChangeLog V 1.0 Complete * Login, Register & Logout function added. * Logout with Click Jacking Protection (Fake URL won't work for logout e.g. http://yourcp.com/logout won't work, every login will have unique logout key which is private) As per our task and deadline, we've finished above tasks with SQL Injection protected, Cross Site Scripting Protected, and Clickjacking protected. Also Adding first look of CP. ============================================================================================ For further milestones, Check @ https://github.com/phpmonkeys/ragnarokcp/issues/milestones And waiting for your suggestions. ============================================================================================ Current first look of CP We know we suck at designing . Slot for designer is open if anyone's intrested ================================================================================================ Hey guys, Hello To Everyone We're phpmonkey's, And few of our members are die hard fans of Ragnarok... True that rest don't understand anything. But still due to their devotion towards ragnarok, we started a project. New control panel for Ragnarok. PHPMonkey's Ragnarok CPanel According to us, there are few control panels of ragnarok running well but just satisfying the basic needs. Not all the potential a cpanel can have. So we started our project with base of strong PHP framework. We've already started working on cPanel source & its available on our github repository. The project is opensource & Free to use and modify as you want. We've already created a list of required functions in cPanel. We won't revel all the functions here, as they're surprise for developers like you, and really reveling the real power of control panel. Currently we've milestone of V 1.0 with simple Login & Register function with multiple combinations of configurations giving expanded capabilities to developers to configure their controlpanel as they want. This project is MVC based, The main headache of existing control panel is you can't simple design them as you want them to be. so You can simple pikup any HTML template from the internet or design yourself and integrate it with existing cpanel within hour or two. Current Deisgn of cpanel on github is not so good but we will improve it by time. If any designer, developer is intrested in contributing, You're welcome folks. Just drop me a message. Thats is also one of our main motives. As the source code is availble. Any bug, suggestions for functions will be appriciated. Here's the link of our repository https://github.com/phpmonkeys/ragnarokcp This project is not at all to compete with anyone, this is just a geniune payback to ragnarok who made my life's segment so special for it. Thanks for reading the topic
    1 point
  3. Perhaps I'm the only one in this world who uses this command Thanks Euphy!
    1 point
  4. It was probably a misunderstanding on Aleos' part. We haven't caught it because, as you've noted, this isn't used in any of the official scripts. Please file a bug report and wait for a developer to get to it--thanks!
    1 point
  5. Search for the text in src/map/clif.c, comment or delete the relevant lines, and recompile. // if player is autotrading if (dstsd->state.autotrade == 1) { char output[256]; safesnprintf(output,sizeof(output),"%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); clif_wis_message(fd, wisp_server_name, output, strlen(output) + 1); return; }
    1 point
  6. Use hex color codes, e.g. mes "^FF0000This text is displayed in red.^000000"; mes "You can also ^FFFF00highlight^000000 individual blocks."
    1 point
  7. you can play with a npc script - script ihbnuio -1,{ OnPCLoginEvent: if ( idonthitmob ) atcommand "@adjgroup <group ID>"; end; }
    1 point
  8. Woa so profesional totally like it :33 i wish it could be coded o:!
    1 point
×
×
  • Create New...