Jump to content

Code Puzzler


Guest Johnson

Recommended Posts

:oops: got this joke code from rumbaars for my script for telling jokes in the room and it works fine i.e !joke tells a random joke ... !joke1 ect will tell the jokes in order from the txt document.

  
on *:TEXT:*!joke*:*: { 
  set %posi $findtok($1-,$matchtok($1-,!joke,1,32),1,32) 

  var %svalue = $ [ $+ [ %posi ] ] 
  if (%svalue == !joke) { /msg # $nick joke for you, $read(Jokes/Joke.txt) } 
  elseif (!joke isin %svalue) && (%svalue != !joke) && ($right(%svalue,-5) isnum) { /msg # $nick joke for you, $read(Jokes/Joke.txt,$right(%svalue,-5)) } 
  unset %posi 
  unset %svalue

 

So what I did was to make a pizza parlour and I changed the joke code for the pizza's i.e. !pizza gives a random pizza .. My Puzzler is if you look at this pizza code all iv done is changed !joke to !pizza but when I type !pizza1 it doesnt work and if I type !pizza 1 it just gives out the pizza's randomly and not in order from the txt document :( if you take a look you will see there is no difference between the codes apart from joke is now pizza :D

 

on *:TEXT:*!pizza*:*: { 
  set %posi $findtok($1-,$matchtok($1-,!pizza,1,32),1,32) 

  var %svalue = $ [ $+ [ %posi ] ] 
  if (%svalue == !pizza) { /msg # $nick here is the pizza you ordered, $read(Pizzas/Pizza.txt) } 
  elseif (!pizza isin %svalue) && (%svalue != !pizza) && ($right(%svalue,-5) isnum) { /msg # $nick here is the pizza you ordered, $read(Pizzas/Pizza.txt,$right(%svalue,-5)) } 
  unset %posi 
  unset %svalue

 

 

Any ideas on this please .. but dont make it to difficult for me to take in lol :D

Link to comment
Share on other sites

Thats pretty complicated code for such a simple procedure.

 

on *:text:*!pizza *:#:{
  if (!$1)  { msg $chan $nick here is the pizza you ordered, $read(Pizzas/Pizza.txt) }
  elseif ($read(pizzas\pizza.txt,$2)) {
    msg $chan $nick here is the pizza you ordered. $ifmatch
  }
  else{
    msg $chan Sorry $nick $+ , we are out of that one. Please place another order.
  }
}

 

 

Here is the same code with a flood protect built in.

 

 

on *:text:*!pizza *:#:{
if (%pizza. [ $+ [ $nick ] ] > 3) return
  if (!$1)  { msg $chan $nick here is the pizza you ordered, $read(Pizzas/Pizza.txt) }
  elseif ($read(pizzas\pizza.txt,$2)) {
    msg $chan $nick here is the pizza you ordered. $ifmatch
  }
  else{
    msg $chan Sorry $nick $+ , we are out of that one. Please place another order.
  }
inc -u5 %pizza. [ $+ [ $nick ] ] 
}

Link to comment
Share on other sites

:lmaojump: Travis love it .. but iv still got to type !pizza(space)1 or 2 ect .. where as in the joke code if I type !joke it gives the room a random joke .. if I type !joke1 or !joke2 ect without the space between .. it works .. but who cares lol I like your code mate :D
Link to comment
Share on other sites

Guest X-Fusion

Well, if wanted to do a completely different one, you could do

on *:TEXT:*!pizza*:*:{
  if (!$1) msg # Here's your pizza! A $read(pizza/pizzas.txt) $+ !
  else msg # Here's your pizza! $read(pizza/pizzas.txt,$2)
}

Usage

!pizza = gives you a random pizza

!pizza n = gives you a pizza which you identify (n = number, ex: !pizza 4)

Make a folder called 'pizza' and a text file inside that folder called pizzas.txt and put your pizza choices in there.

Link to comment
Share on other sites

on *:text:*!pizza*:#:{
  if (%pizza. [ $+ [ $nick ] ] > 3) return
  if ($remove($1,!pizza)) {
    if ($read($read(pizzas\pizza.txt,$ifmatch)) {
      msg $chan $nick here is the pizza you ordered. $ifmatch
    }
    else {
      msg $chan Sorry $nick $+ , we are out of that one. Please place another order.
    }
  }
  else { msg $chan $nick here is the pizza you ordered, $read(Pizzas/Pizza.txt) }
  inc -u5 %pizza. [ $+ [ $nick ] ] 
}

 

!pizza1

Link to comment
Share on other sites

  • Site Moderator

Heres a complete code for !Restaurant with all the various food groups LOL :lolwave:

 

 

 

on *:TEXT:!Restaurant:#:{ 
 .timer 1 1 .notice $nick |The Menu| 
 .timer 1 3 .notice $nick The Foods: Beans - Burger - Cheeseburger - Chips - Fish - Fries - Nachos - Pizza - Pizza (Toppings) - Popcorn - Salsa - Steak - Taco - Tuna - Wedges 
 .timer 1 5 .notice $nick The Drinks: Beer - Cider - Fanta - Juice - Lemonade - Margarita - Milk - Redwine - Rome - Tequila - Water - Whitewine 
 .timer 1 7 .notice $nick The Desserts: Cake - Hostess - IceCream - Muffin -  Pie - Reese's - 1,9S0,3K0,4I1,8T0,10T0,4L0,3E1,9S - Twix 
 .timer 1 9 .notice $nick The Fountain Drinks: 14,14!1,140,3 74,3°0,3UP 14,14! - 14,14!0,4Diet Coke14,14! - 14,14!15,5RtBeer14,14! - 14,14!8,5Dr.Pepper14,14! - 14,14!0,6Grape14,14! - 14,14!8,7Orange14,14! - 14,14!4,12Pepsi14,14! - 14,14!1,140,3Slice14,14! - 14,14!0,4Coke14,14! - 14,14!1,148,3MtDew14,14! - 14,14!1,140,3Sprite14,14! - 14,14!15,5Mr.Pibb14,14! 
 .timer 1 11 .notice $nick To order type ! and then the food, drink, or dessert. For example: !Coke 
} 
on *:TEXT:!Pizza:#:inc %Pizzacount | Describe $chan makes $nick a fresh, delicious pizza. ( $+ %Pizzacount pizzas have been ordered). 
on *:TEXT:!Pizza*:#: { 
 inc %Pizzatoppingcount 
 if ($6 isin $1-) { Describe $chan makes $nick a fresh, delicious pizza with $2, $3, $4, $5, and $6 on top. ( $+ %Pizzatoppingcount pizzas with toppings have been ordered). } 
 elseif ($5 isin $1-) { Describe $chan makes $nick a fresh, delicious pizza with $2, $3, $4, and $5 on top. ( $+ %Pizzatoppingcount pizzas with toppings have been ordered). } 
 elseif ($4 isin $1-) { Describe $chan makes $nick a fresh, delicious pizza with $2, $3, and $4 on top. ( $+ %Pizzatoppingcount pizzas with toppings have been ordered). } 
 elseif ($3 isin $1-) { Describe $chan makes $nick a fresh, delicious pizza with $2 and $3 on top. ( $+ %Pizzatoppingcount pizzas with toppings have been ordered). } 
 elseif ($2 isin $1-) { Describe $chan makes $nick a fresh, delicious pizza with $2 on top. ( $+ %Pizzatoppingcount pizzas with toppings have been ordered). } 
} 
on *:TEXT:!Nachos:#:inc %Nachocount | Describe $chan hands $nick a plate of nachos and cheese. ( $+ %Nachocount nachos have been ordered). 
on *:TEXT:!Tuna:#:inc %Tunacount | Describe $chan hands $nick a can of tuna. ( $+ %Tunacount tunas have been ordered). 
on *:TEXT:!Coke:#:inc %Cokecount | Describe $chan tosses $nick a can of 14,14!0,4Coke14,14!. ( $+ %Cokecount cans of Coke have been ordered). 
on *:TEXT:!Cider:#:inc %Cidercount | Describe $chan tosses $nick a bottle of scrumpy. ( $+ %Cidercount ciders have been ordered). 
on *:TEXT:!Hostess:#:inc %Hostesscount | Describe $chan tosses $nick a Hostess cake. ( $+ %Hostesscount Hostess's have been ordered). 
on *:TEXT:!Fish:#:inc %Fishcount | Describe $chan grills up a fresh, tasty fish for $nick $+ . ( $+ %Fishcount fishes have been ordered). 
on *:TEXT:!Steak:#:inc %Steakcount | Describe $chan makes $nick a big, juicy steak. ( $+ %Steakcount steaks have been ordered). 
on *:TEXT:!Pie:#:inc %Piecount | Describe $chan bakes $nick a hot apple pie. ( $+ %Piecount pies have been ordered). 
on *:TEXT:!Muffin:#:inc %Muffincount | Describe $chan bakes $nick a fresh, tasty muffin. ( $+ %Muffincount muffins have been ordered). 
on *:TEXT:!Reese's:#:inc %Reese'scount | Describe $chan tosses a $nick a Reese's Peanut Butter Cup (Life's good between Reese's Peanut Butter Cups). ( $+ %Reese'scount Reese's have been ordered). 
on *:TEXT:!Cake:#:inc %Cakecount | Describe $chan bakes $nick a cake. ( $+ %Cakecount cakes have been ordered). 
on *:TEXT:!Twix:#:inc %Twixcount | Describe $chan tosses $nick a Twix (Need a moment? Chew it over with Twix). ( $+ %Twixcount Twix have been ordered). 
on *:TEXT:!Skittles:#:inc %Skittlescount | Describe $chan tosses $nick a bag of 1,9S0,3K0,4I1,8T0,10T0,4L0,3E1,9S (Skittles, taste the rainbow). ( $+ %Skittlescount Skittles have been ordered). 
on *:TEXT:!Juice:#:inc %Juicecount | Describe $chan pours $nick a glass of juice. ( $+ %Juicecount juices have been ordered). 
on *:TEXT:!Beans:#:inc %Beanscount | Describe $chan opens up a can of beans and serves them to $nick $+ . ( $+ %Beanscount beans have been ordered). 
on *:TEXT:!Milk:#:inc %Milkcount | Describe $chan hands $nick a tall glass of milk. ( $+ %Milkcount milks have been ordered). 
on *:TEXT:!Popcorn:#:inc %Popcorncount | Describe $chan flicks popcorn at $nick $+ . ( $+ %Popcorncount popcorns have been ordered). 
on *:TEXT:!Salsa:#:inc %Salsacount | Describe $chan hands $nick some salsa to dip $nick $+ 's chips in. ( $+ %Salsacount salsas have been ordered). 
on *:TEXT:!Taco:#:inc %Tacocount | Describe $chan hands $nick a big meat-filled taco. ( $+ %Tacocount tacos have been ordered). 
on *:TEXT:!Grape:#:inc %Grapecount | Describe $chan tosses $nick a can of 14,14!0,6Grape14,14!. ( $+ %Grapecount cans of Grape have been ordered). 
on *:TEXT:!RedWine:#:inc %Redwinecount | Describe $chan tosses $nick a bottle of the red wine. ( $+ %Redwinecount red wines have been ordered). 
on *:TEXT:!WhiteWine:#:inc %Whitewinecount | Describe $chan tosses $nick a bottle of the white wine. ( $+ %Whitewinecount white wines have been ordered). 
on *:TEXT:!7up:#:inc %7upcount | Describe $chan tosses $nick a can of 14,14!1,140,3 74,3°0,3UP 14,14!. ( $+ %7upcount cans of 7up have been ordered). 
on *:TEXT:!Margarita:#:inc %Margaritacount | Describe $chan tosses $nick a bottle of the mexican margarita. ( $+ %Margaritacount margaritas have been ordered). 
on *:TEXT:!Tequila:#:inc %Tequilacount | Describe $chan tosses $nick a bottle of tequila. ( $+ %Tequilacount tequilas have been ordered). 
on *:TEXT:!Rome:#:inc %Romecount | Describe $chan tosses $nick a bottle of rome. ( $+ %Romecount romes have been ordered). 
on *:TEXT:!Fries:#:inc %Friescount | Describe $chan hands $nick a basket of fries. ( $+ %Friescount fries have been ordered). 
on *:TEXT:!Fanta:#:inc %Fantacount | Describe $chan tosses $nick a can of Fanta. ( $+ %Fantacount Fanta have been ordered). 
on *:TEXT:!Lemonade:#:inc %Lemonadecount | Describe $chan hands $nick a glass of lemonade. ( $+ %Lemonadecount lemonades have been ordered). 
on *:TEXT:!Water:#:inc %Watercount | Describe $chan hands $nick a glass of water. ( $+ %Watercount waters have been ordered). 
on *:TEXT:!Mr.Pibb:#:inc %Mr.Pibbcount | Describe $chan tosses $nick a can of 14,14!15,5Mr.Pibb14,14!. ( $+ %Mr.Pibbcount cans of Mr.Pibb have been ordered). 
on *:TEXT:!Sprite:#:inc %Spritecount | Describe $chan tosses $nick a can of 14,14!1,140,3Sprite14,14!. ( $+ %Spritecount cans of Sprite have been ordered). 
on *:TEXT:!MtDew:#:inc %Mtdewcount | Describe $chan tosses $nick a can of 14,14!1,148,3MtDew14,14!. ( $+ %Mtdewcount cans of MtDew have been ordered). 
on *:TEXT:!Orange:#:inc %Orangecount | Describe $chan tosses $nick a can of 14,14!8,7Orange14,14!. ( $+ %Orangecount cans of Orange have been ordered). 
on *:TEXT:!Pepsi:#:inc %Pepsicount | Describe $chan tosses $nick a can of 14,14!4,12Pepsi14,14!. ( $+ %Pepsicount cans of Pepsi have been ordered). 
on *:TEXT:!DR.Pepper:#:inc %Dr.peppercount | Describe $chan tosses $nick a can of 14,14!8,5Dr.Pepper14,14!. ( $+ %Dr.peppercount cans of Dr.Pepper have been ordered). 
on *:TEXT:!RtBeer:#:inc %RtBeercount | Describe $chan tosses $nick a can of 14,14!15,5RtBeer14,14!. ( $+ %RtBeercount cans of RtBeer have been ordered). 
on *:TEXT:!DietCoke:#:inc %Dietcokecount | Describe $chan tosses $nick a can of 14,14!0,4Diet Coke14,14!. ( $+ %Dietcokecount cans of DietCoke have been ordered). 
on *:TEXT:!Beer:#:inc %Beercount | Describe $chan tosses $nick a can of beer. ( $+ %Beercount beers have been ordered). 
on *:TEXT:!Wedges:#:inc %Wedgescount | Describe $chan hands $nick potato wedges. ( $+ %Wedgescount wedges have been ordered). 
on *:TEXT:!IceCream:#:inc %Ice-creamcount | Describe $chan hands $nick a bowl of ice cream. ( $+ %Ice-creamcount ice creams have been ordered). 
on *:TEXT:!Chips:#:inc %Chipscount | Describe $chan hands $nick a plate of chips. ( $+ %Chipscount chips have been ordered). 
on *:TEXT:!Cheeseburger:#:inc %Cheeseburgercount | Describe $chan hands $nick a cheeseburger. ( $+ %Cheeseburgercount cheeseburgers been have ordered). 
on *:TEXT:!Slice:#:inc %Slicecount | Describe $chan tosses $nick a can of 14,14!1,140,3Slice14,14!. ( $+ %Slicecount cans of Slice have been ordered). 
on *:TEXT:!Burger:#:inc %Burgercount | Describe $chan hands $nick a burger. ( $+ %Burgercount burgers have been ordered). 

Link to comment
Share on other sites

:lmaojump: ok nice snippet tested it and it works fine ... one question it comes into the room as purple italic .. I want it to come into the room as the same font as the script (connection vincula / server spcn) .. here is an example (Is this one of yours X-Fusion) lol

 

Slap!:/me slaps $$1 around a bit with a large trout

 

but if I do this

 

Slap!:/say slaps $$1 around a bit with a large trout

 

it will come into the room wiv the font that Iv chosen from vincula.

 

Below is a line from the restaurant, can this be changed so it will come into the room wiv the chosen font from the script .. iv tried different things but to no avail :(

 

on *:TEXT:*!Cider:#:inc %Cidercount | Describe $chan tosses $nick a bottle of scrumpy. ( $+ %Cidercount ciders have been ordered).

 

I do hope iv explained myself clearly and I hope that you understand what iv sed :D X-Fusion I was joking lol ;)

Link to comment
Share on other sites

/me and /describe are "action" events, and hence why it appears as purple. if you wanted it as normal text, change "describe $chan" to "msg $chan".

 

:lmaojump: TGK thankyou mate for that reply .. you learn something everyday and I will remeber that in future .. im over the moon wiv that reply :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...