Jump to content
  • 0

comment on my 1st script ?


Ajjwidjdneidjenw

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

* entirely off topic post

darned, got beaten by experience XD (Could've done it that way yeah.).

hey, tbh I've started scripting in April(an easter event was my first script, yay goto's labels and overall poorly coded), gotta give me some credit :P.

Found it, one of my first scripts..

//Made by Jeroen
//Made using the rachel sanc quest as layout
moscovia.gat,225,191,5    script    Easter Bunny    1322,{

   if (EB_COMPLETE == 1) {
   mes "[bunny]";
   mes "Thank you so much for returning my eggs!";
   close;
   end;
   }

   mes "[bunny]";
   mes "Hello!";
   mes "I am the easter bunny!";
   mes "I know my appearance is a little bit strange but that's because I lost my Eggs!";
   mes "If you manage to find all my eggs I wil give you a reward!";
   next;


   if ((RED_EGG == 1) && (BLUE_EGG == 1) && (YELlOW_EGG == 1) && (GREEN_EGG == 1) && (PURPLE_EGG == 1) && (BLACK_EGG == 1) && (GOLD_EGG == 1)) {
   mes "[bunny]";
   mes "Oh! I see you have my eggs!";
   mes "Would you like to receive your items now ?";
   next;
   menu "Redeem Item",-,"Cancel",EB_END;
   }
   Else {
   mes "[bunny]";
   mes "I think I lost my eggs while traveling through the following locations:";
   mes "Poring heaven, The ruins of Morocc, The new worlds camp,in the realm of anubises,";
   mes "In a Toy Factory, In a lair of a 3 headed dragon and under a gaint tree in amatsu";
   next;
   mes "[bunny]";
   mes "Please help me find them.";
   set EB_START,1;
   close;
   end;
   }

   if(checkweight(607,1) == 0){
       mes "[bunny]";
       mes "You are carrying too many items!";
       mes "Please come back later!";
       close;
   }

   mes "[bunny]";
   mes "Here we go!";
   Next;

       mes "[bunny]";
       mes "What will it be?! Time to find out!";
       Next;
       set .@bonus_ticket,rand(50);
       if (.@bonus_ticket == 50) getitem 5378,1;    // Bunny top hat 2% chance
       else if (.@bonus_ticket > 21 && .@bonus_ticket < 44) getitem 7619,1;    //Enriched Elunium 22%
       else if (.@bonus_ticket > 0 && .@bonus_ticket < 20) getitem 14208,1; //Field Manual Box 38%
       else getitem 13914,1; // Party Assumptio scrollbox 38%
       next;
       mes "[Lottery Machine]";
       mes "Congratulations! Come back soon!";
       set #EB_COMPLETE,1;
       set EB_START,0;
       close;
       end;

EB_END:
   mes "[bunny]";
   mes "Come back soon!";
   close;
   end;

}

pay_fild04,146,107,3    script    RedEgg#Red    -1,3,3,{
   end;

OnTouch:
if (RED_EGG == 1)
   end;

   if (EB_START == 1) {
   mes "["+strcharinfo(0)+"]";
   mes "I can see a red egg up in that tree";
   mes "if only I had some sort of ^6B8E23Strong Branch^000000";
   next;
   if (countitem(7203) > 0) {
   mes "["+strcharinfo(0)+"]";
   mes "Oh wait! I do have some!";
   mes "Lets try to get it out!";
   next;
   set .@red_eggget,rand(1,20);
   if (.@red_eggget < 3) {
   mes "["+strcharinfo(0)+"]";
   mes "Yes! I got the Red egg!";
   set RED_EGG,1;
   close;
   }
       else {
       delitem 7203,1; //Strong Branch
       Mes "^6B8E23The Strong Branch broke in the attempt^000000";
       close;
       }
   }
   else {
   mes "["+strcharinfo(0)+"]";
   mes "I better start collecting some";
   close;
   }
}
}

mid_camp,227,235,3    script    BlueEgg#Blue    -1,3,3,{
   end;

OnTouch:
if (BLUE_EGG == 1)
   end;

   if (EB_START == 1) {
   mes "["+strcharinfo(0)+"]";
   mes "Ah!! I see a blue egg!";
   mes "But it's stuck in this triangular shape thing.";
   mes "I wonder if I can get it out.";
   next;
   mes "^0003FF*clink* *Clink* *CLANG CLANG*^000000";
   next;
   mes "["+strcharinfo(0)+"]";
   mes "By the power of all Whitesmiths!!!!";
   mes "I will pull you out!";
   next;
   mes "^0003FF*BANG* *BANG* *BANG*^000000";
   specialeffect2 EF_Blessing;
   next;
   specialeffect2 EF_OVERTHRUST;
   next;
   mes "["+strcharinfo(0)+"]";
   mes "I got the blue egg!";
   set BLUE_EGG,1;
   close;
   }
}

moc_ruins,59,161,3    script    YellowEgg#Yellow    -1,3,3,{
   end;

OnTouch:
if (YELLOW_EGG == 1)
   end;

   if (EB_START == 1) {
   mes "[????]";
   mes "hehehehe.....";
   mes "Are you looking for this?";
   next;
   mes "["+strcharinfo(0)+"]";
   mes "Yes! But how did you know?";
   mes "and where did you get it from?";
   next;
   mes "[Kafra Employee]";
   mes "You may have it under one condittion.";
   mes "You will need to answer the following questions";
   mes "Are you ready?";
   switch(select("Yes!?:...No! I don't want to.")) {
   next;
   case 1:
       mes "[Kafra employee]";
       mes "Well then,";
       mes "let's begin.";
       next;
       mes "[Kafra employee]";
       mes "What day is easter Celebrated?";
       next;
       if (select("Sunday:Teusday:Friday:Saturday") == 1)
       set .@yellow_q,.@yellow_q+10;
       mes "[Kafra employee]";
       mes "Why do we have eggs at Easter?";
       next;
       if (select("Because they are yummy:They resemble Rebirth:Because.. just give me the egg") == 2)
       set .@yellow_q,.@yellow_q+10;
       mes "[Kafra employee]";
       mes "Which came first?";
       next;
       if (select("The chicken:The egg:None of Both:Jero") == 3)
       set .@yellow_q,.@yellow_q+10;
       mes "[Kafra employee]";
       mes "A female rabbit is called a...?";
       next;
       if (select("Doe:Cow:chicken:JC") == 1)
       set .@yellow_q,.@yellow_q+10;
       mes "[Kafra employee]";
       mes "What kind of tail does the easter bunny assumed to have?";
       next;
       if (select("Cutton Tail:Chocolate Tail:Liquor Tail:Bunny's have tails?") == 1)
       set .@yellow_q,.@yellow_q+10;
       mes "[Kafra employee]";
       mes "Okay, this is the end of the test!";
       next;
       if (.@yellow_q > 39) {
       mes "[Kafra employee]";
       set YELlOW_EGG,1;
       mes "Fine you can have the egg";
       next;
       mes "You got the Yellow egg!";
       close;
       }
       else {
       mes "[Kafra employee]";
       mes "I'm sorry you failed";
       mes "Please try agian!";
       close; }
   case 2:
   mes "[Kafra employee]";
   mes "come back later!";
   close;
   }
}
}

in_sphinx4,25,214,3    script    GreenEgg#Green    -1,3,3,{
   end;

OnTouch:
if (GREEN_EGG == 1)
   end;

if ((TABLET_A == 1) && (TABLET_B == 1) && (TABLET_C == 1) && (TABLET_D == 1) && (TABLET_E == 1)) {
   mes "You inserted all of the tablets into the wall";
   mes "A hidden hatch opened,";
   mes "and you received the green egg!";
   set GREEN_EGG,1;
   set TABLET_A,0;
   set TABLET_B,0;
   set TABLET_C,0;
   set TABLET_D,0;
   set TABLET_E,0;
   close;
   }
if (TABLET_A == 1)
   end;

   if (EB_START == 1) {
   mes "["+strcharinfo(0)+"]";
   mes "Hm... there is a strange writing on the wall";
   next;
   mes "^0003FFIn order to get the Green egg";
   mes "You will need to find 5 Tablets";
   mes "You can find them on your minimap as you go along";
   mes "After you got all 5 Tablet, return to this point^000000";
   next;
   viewpoint 1,20,230,4,0x00FF00;
   mes "^0003FF You got Tablet A!";
   set TABLET_A,1;
   close;
   }
}

in_sphinx4,20,230,3    script    TABLET_B#Green    -1,3,3,{
   end;

OnTouch:
if (GREEN_EGG == 1)
   end;

if (TABLET_B == 1)
   end;

if (TABLET_A == 1) {
   mes "You have found tablet B!";
   set TABLET_B,1;
   viewpoint 1,16,7,4,0x00FF00;
   close;
   }
}

in_sphinx4,16,15,3    script    TABLET_C#Green    -1,3,3,{
   end;

OnTouch:
if (GREEN_EGG == 1)
   end;

if (TABLET_C == 1)
   end;

if (TABLET_A == 1) {
   mes "You have found tablet C!";
   set TABLET_C,1;
   viewpoint 1,119,122,4,0x00FF00;
   close;
   }
}

in_sphinx4,119,122,3    script    TABLET_D#Green    -1,3,3,{
   end;

OnTouch:
if (GREEN_EGG == 1)
   end;

if (TABLET_D == 1)
   end;

if (TABLET_A == 1) {
   mes "You have found tablet D!";
   set TABLET_D,1;
   viewpoint 1,229,55,4,0x00FF00;
   close;
   }
}

in_sphinx4,229,55,3    script    TABLET_E#Green    -1,3,3,{
   end;

OnTouch:
if (GREEN_EGG == 1)
   end;

if (TABLET_E == 1)
   end;

if (TABLET_A == 1) {
   mes "You have found tablet E!";
   set TABLET_E,1;
   close;
   }
}
amatsu,263,195,3    script    Angel Rabbit#Purple    1063,3,3,{

if (PURPLE_EGG == 1)
   end;

   if (EB_START == 1) {
   mes "There's a rabbit here, guarding a purple egg.";
   mes "What will you do to take the egg?";
   next;
   switch(select("Pet the rabbit:Kick the rabbit:Eat the rabbit:just walk away")) {
       case 1: {
       mes "you attempted to pet the rabbit";
       mes "The rabbit got scared and bit you.";
       mes "in the mean time you managed t take the egg";
       percentheal -60,0;
       set PURPLE_EGG,1;
       close;
       }
       break;
       case 2:  {
       mes "You kicked the rabbit, sending it flying";
       mes "in the meantime you grab the egg, it is now yours.";
       set PURPLE_EGG,1;
       close;
       }
       break;
       case 3: {
       mes "you started to boil a hot soup and put the rabbit in the bowl.";
       mes "hm... Rabbit stew.";
       mes "you restored all your energy, and you got the purple egg.";
       percentheal 100,100;
       set PURPLE_EGG,1;
       close;
       }
       break;
       case 4:
       mes "you ran away";
       close;
   }
}
}

mosk_dun03,222,229,3    script    BLACK_EGG#BLACK    -1,3,3,{
   end;

OnTouch:
If (BLACK_EGG == 1)
end;    

if (EB_START == 1) {
   mes "You see a black egg in between the pile of skulls";
   mes "you will need about 50 holy waters, to clear the way to the black egg.";
   next;
   if (countitem(523) > 49) {
       mes "You have enough holy waters to clear the way";
       mes "Do you want to use them?";
       next;
       menu "yes",-,"no",BA_END;
       mes "You cleared your way and got the black egg!";
       delitem 523,50; //Holywater
       set BLACK_EGG,1;
       close;

BA_END:
Close;
       }

   mes "Better start get some holy waters!";
   close;
   }
}

xmas_dun01,205,27,3    script    Chepet#GOLD    1250,3,3,{

if (GOLD_EGG == 1)
end;
   if ((countitem(7035) > 0) && (countitem(969) > 0) && (countitem(7053) > 99)) {
   mes "[Chepet]";
   mes "I see you have the items!";
   mes "Do you want to make a trade?";
   menu "yes",-,"no",GO_END;
   next;
   mes "Thank you!";
   delitem 7035,1;
   delitem 969,1;
   delitem 7053,100;
   set GOLD_EGG,1;
   close;
   }
   mes "[Chepet]";
   mes "hello! I see you are";
   mes "interested in this golden egg I found";
   next;
   mes "[Chepet]";
   mes "How about a little trade?";
   mes "I want the following items:";
   mes "^0003FF1 Match stick";
   mes "1 Gold";
   mes "and 100 Cyfar";
   next;
   mes "[Chepet]";
   mes "Please bring them to me";
   close;

GO_END:
close;

}

This doesn't belong here though, mind if we continue this in a PM :P?

Edited by AnnieRuru
split topic from topic ID 74909
Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

if talking about bits

our rathena has already using it in several ways

my 1st impression when I saw keyworld script,

is battle_check_target function in our SVN

enum e_battle_check_target
{//New definitions [skotlex]
   BCT_ENEMY   = 0x020000,
   BCT_NOENEMY = 0x1d0000, //This should be (~BCT_ENEMY&BCT_ALL)
   BCT_PARTY    = 0x040000,
   BCT_NOPARTY = 0x1b0000, //This should be (~BCT_PARTY&BCT_ALL)
   BCT_GUILD    = 0x080000,
   BCT_NOGUILD = 0x170000, //This should be (~BCT_GUILD&BCT_ALL)
   BCT_ALL     = 0x1f0000,
   BCT_NOONE   = 0x000000,
   BCT_SELF    = 0x010000,
   BCT_NEUTRAL = 0x100000,
};

using the exact same way

I got experience on this because I always modify this function inside battle.c for gvg and battleground scripts

also resemble how the way bonus4 item database script commands doing it

BF_WEAPON    0x0001
BF_MAGIC    0x0002
BF_MISC    0x0004
BF_SHORT    0x0010
BF_LONG    0x0040
BF_SKILL    0x0100
BF_NORMAL    0x0200

ATF_SELF    0x01
ATF_TARGET    0x02
ATF_SHORT    0x04
ATF_LONG    0x08
ATF_WEAPON    0x10
ATF_MAGIC    0x20
ATF_MISC    0x40
ATF_SKILL    0x60

needless to say our job system ... like eaclass made by skotlex


btw from post#1 about easter bunny topic

and post#6 to christmas event

I still suggesting quest log system is more a practical method

1. quest log system need to patch data\questid2display.txt client side file

2. christmas also need to patch snow theme maps, something like this xD

so everything about christmas theme, just patch everything about it 1 week before christmas

also ... the christmas songs !!

OnPCLoginEvent:
   playbgm "57";
   message strcharinfo(0), "Merry Christmas !!";
   sleep2 3000;
   message strcharinfo(0), "and a HAPPY NEW YEAR !!";
   end;

feels like christmas mood already XD

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

@Offtopic - Your telling me... I've done nothing but decorate for Christmas, for the last: 90 hours during work these past 2 weeks.... and to make it worse, i'm probaly only 1/4th of the way Done T.T

@Bits (lol) - I'm 100% for this topic, as I currently am not that great with them, granted I understand it, my ability to produce results with it, isn't so great. It's like reading directions, sure you understand them, but you can't always produce the same results as intended.

I'm sure alot of scripters, would find the topic interesting, besides I'm sure even the newer gen-scripters who are starting, would get a giant information resource to look at, with both Keyworld & Annieruru throwing around examples lol. But lets not forget Toasty & Brian & Emistry... I can almost garantee they'll shoot a couple out as well.

Edited by GmOcean
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

I know how the quest system works Annie, thanks anyway :P. I'm mainly just struggling with the bit masks and such.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

@Annie:

The system above the source is really different from NPC scriptings. You can see yourself you have structures and pointers in the source, for not speaking about the higher variable setups and types, like enumerations, booleans and others.

Bits are used for different purpose other than for NPC scriptings. Pointers works pretty well with stack, heap, blocks of memory and bits.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

I just read all the messages properly, and Wow. I seem to understand it a little bit now, but I think I'll have to create a few scripts utilizing the bitmask for me to actually understand properly. Thanks! I'll go build something shortly. (once I come up with something)

Edited by garet999
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

@Ryokem

try to read battle_check_target function in battle.c

return (flag&state)?1:-1;

if its 1, then the target is attack-able

if its -1 or 0, then the target cannot be attack

I'm sure you can read the source file ... no need me to explain ...

somehow I feel like you love to attack my post because I have no programming background :ani_swt3:

@garet999

no need to be shame of yourself if you want to ask questions

because I also did the same in the past

http://www.eathena.w...howtopic=177218

http://www.eathena.w...howtopic=269819

http://www.eathena.w...howtopic=276305

learning is a lifetime process /heh

mark this topic as [solved] :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

I'm sure you can read the source file ... no need me to explain ...

somehow I feel like you love to attack my post because I have no programming background :ani_swt3:

Nah, I don't have any purpose on "attacking" you or your posts. Do you think I really have any interest about showing my abilities this way? I would have way better things to do xD. Just I feel that you are pretty nice a cooperative girl, and your help is good for a nice community, so matching with you and the others is (in my opinion) always a good way for both sides (so me as well) to improve their knowledges or to learn something new. Also 'cause even if my knowledges about Programming are quite good, rAthena is still a new world for me, and facing people who knows it can help me to understand the whole rA background system. So don't feel like I'm attacking anyone xD *pokes Annie and hugs her kindly* :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...