Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
help with my plugin

 
Post new topic   Reply to topic Printable version
 View previous topic  AI Bot Post :: Post All AI bots  View next topic  
Author Message
Guest



Offline

PostPosted: Fri Feb 10, 2006 3:12 pm    Post subject: help with my plugin Reply to topic Reply with quote

this is an MERVbot plugin i wanted to write but i dont have any clue HOW!
well here are some file from a plugin i wanted to create
the meaning of it:
Gives a certain amount of creds for the won jp to the players of the winning team.
Amount of creds given is determend with: jackpot:50
i wrote it in command.cpp with // declaration where i tryed to write it.
errors i get:
E:\MERVBOT\TUTORIAL\backup\command.cpp(143) : error C2065: 'event' : undeclared identifier
E:\MERVBOT\TUTORIAL\backup\command.cpp(143) : error C2228: left of '.p' must have class/struct/union type
E:\MERVBOT\TUTORIAL\backup\command.cpp(144) : error C2228: left of '.p' must have class/struct/union type
E:\MERVBOT\TUTORIAL\backup\command.cpp(145) : error C2143: syntax error : missing ';' before ':'
E:\MERVBOT\TUTORIAL\backup\command.cpp(145) : error C2143: syntax error : missing ';' before ':'
Error executing cl.exe.




speaks for itself...

spawn.h - 2.41 KB
File downloaded or viewed 14 time(s)

speaks for itself...

spawn.cpp - 11.07 KB
File downloaded or viewed 13 time(s)

here i wrote everything in.

command.cpp - 4.65 KB
File downloaded or viewed 21 time(s)
Back to top
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Fri Feb 10, 2006 3:13 pm    Post subject: ohh oops Reply to topic Reply with quote

oh forgot to login deleted my cookies
that was me who posted it.. sa_tongue.gif icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:35
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2019
Offline

PostPosted: Fri Feb 10, 2006 4:02 pm    Post subject: Reply to topic Reply with quote

Uhh, that's not supposed to be in command.cpp. Add code into your spawn.cpp under EVENT_FlagVictory, not in a random place in command.cpp.

Also, your declaration of "credreward" is wrong because you're not really assigning a number to it (what is reward : 50?). To cgive those creds to the entire team that won, you'll have to cycle through the playerlist and check for the team that won (using the declaration of "team"), then give the amount of creds needed as your "credreward" declaration.

You should also use sendRemotePrivate(p, "msg"); instead of the sendPublic way that you've used.
Back to top
View users profile Send private message Add User to Ignore List
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Fri Feb 10, 2006 4:34 pm    Post subject: Lol Reply to topic Reply with quote

well bout that in spawn.cpp i already thought that but i dont get the rest you told me icon_cry.gif im dutch not verry good in such english words. icon_confused.gif well i realy think i can go further with this...
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Fri Feb 10, 2006 5:36 pm    Post subject: Reply to topic Reply with quote

Let me tell this guy something he will actually understand.

Witchie NL wrote:
im dutch not verry good in such english words.

Blijkbaar, wat voor onderwijs volg je, speciaal onderwijs ofzo? Wat een kutexcuus om laksheid te kunnen rechtvaardigen. sa_tongue.gif

Je hebt duidelijk geen enkel idee waar je mee bezig bent en de aangeboden hulp begrijp je ook niet, waarom denk je dat je hiermee door kunt gaan?

Leer werken met een simpele plugin en lees daarna de code. Stap door de code met je debugger, zoek uit wat de code precies doet.
Uiteindelijk, na een behoorlijk lange tijd, wat jou betreft, zul je het gaan snappen en ben je er klaar voor om een plugin te schrijven. In dit stadium ben je beter af met iemand die wel kundig genoeg is op dit gebied.
Back to top
View users profile Send private message Add User to Ignore List
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Sat Feb 11, 2006 3:13 am    Post subject: ... Reply to topic Reply with quote

dit is ook precies hoe ik het aan het doen was, en nee ik zit op de middelbare 4e klas maar me engels is kut... (sta er een 4 voor) maar het is al gefixd en nee ik weet soms idd niet precies waar ik me bezig ben biggrin.gif icon_biggrin.gif ...
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sat Feb 11, 2006 6:25 am    Post subject: Reply to topic Reply with quote

Ik zat je maar wat te stangen, maar toch.
Ik zal je eerst even wat basisprincipes uitleggen, laten we daarna eens kijken wat je gedaan hebt.

Een variabele, is een soort van "doosje", om het simpel uit te leggen. In een doosje kun je iets bewaren, bijvoorbeeld de doosje met de naam "nummer".

Wat je erin kunt bewaren ligt aan het type en de grootte van het doosje. Als je in de variabele nummer een nummer wilt kunnen opslaan zul je er een type aan toe moeten kennen. Voor nummers gebruikt men "int".
Als je een declaratie doet (een variabele aanmaakt) zet je het datatype ervoor en sluit af met een ';'.

Dit zou er zo uitzien:
Code: Show/Hide
int nummer;


Hierin kun je nu je nummer opslaan. Als je tijdens de declaratie al een nummer toe wilt kennen aan de variabele, dan kun je dat gewoon doen op deze manier:
Code: Show/Hide
int nummer;
nummer = 3;

dit is hetzelfde als dit:
Code: Show/Hide
int nummer = 3;


Een variabele moet bestaan voordat je er iets mee kunt gaan doen, en een variabele bestaat niet overal in het programma. Het bereik van een variabele noemen we "scope".

Een voorbeeld:

Code: Show/Hide
void functie()
{
   int nummer = 2;

   if (nummer < 3)
   {
      char letter; // <-- Dit is een letter variabele ("character"). Deze bestaat alleen tussen de { } van dit if-statement.
      printf("Het nummer is lager dan 3!\n");
   }
   // Hier bestaat onze variabele genaamd 'letter' niet meer, daarentegen bestaat de variabele 'nummer' wel.
}


In de code voor de plugin die je probeert te maken maak jij gebruik van variabelen die helemaal niet bestaan op die plaats.
Het zal ook niet de bedoeling zijn om die variabelen op die plaats te gebruiken, zoals Purge+ al zei: "Uhh, het is niet de bedoeling dat je dat in command.cpp plaats. Voeg de code toe onder EVENT_FlagVictory, niet een willekeurige plaats in command.cpp.", dat zul je inderdaad op die andere plaats moeten doen.

Ik wil je best proberen te helpen (als je dat zou willen), mits je geduldig genoeg bent. In je profiel op deze forums staat een hotmail adres, wil je dat ik het toevoeg?
Back to top
View users profile Send private message Add User to Ignore List
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Sat Feb 11, 2006 8:03 am    Post subject: oke Reply to topic Reply with quote

tuurlijk voeg maar toe en geduld heb ik zeker wel maar purge+ had die plugin gemaakt (veel van geleerd btw) maar voer tog maar toe want kan alteid handig zijn icon_biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Sun Feb 12, 2006 9:38 am    Post subject: hmpf Reply to topic Reply with quote

i was doing the plugin and it all worked so i was building in some countdowns:
Code: Show/Hide
   case EVENT_Tick:
      {
         if (!start)
            break;

         int team = *(int*)&event.p[0];
         int reward = *(int*)&event.p[1];
         double value = 0.02;
         double credreward = reward * value;

         for (int i = 0; i < 4; ++i)
            --countdown[i];

         if (countdown[1] == 240) // when timer #1 hits 240 seconds
            sendPublic("Reward of creds for jackpot is now: " + String(credreward));
         if (countdown[1] == 180) // when timer #1 hits 180 seconds
            sendPublic("Reward of creds for jackpot is now: " + String(credreward));
         if (countdown[1] == 120) // when timer #1 hits 120 seconds
            sendPublic("Reward of creds for jackpot is now: " + String(credreward));
         if (countdown[1] == 60) // when timer #1 hits 60 seconds
            sendPublic("Reward of creds for jackpot is now: " + String(credreward));
         if (countdown[1] == 0) // when timer #1 hits 0 seconds
            sendPublic("Reward of creds for jackpot is now: " + String(credreward));
      }

its supose to say (if jp is 100): Reward of creds for jackpot is now: 2
but the only thing it sais is: .... is now: 0 icon_confused.gif icon_sad.gif
does anyone know how to let this work?
i also need to know how to let the countdowns restart if it is ended coz isnt realy usefull if it just lasts for ... min needs to be unlimited countdowns.




speaks for itself...

spawn.h - 2.5 KB
File downloaded or viewed 17 time(s)

wrote everything in here (x-cept !start - !stop)

spawn.cpp - 12.53 KB
File downloaded or viewed 20 time(s)

!start and !stop are here...

command.cpp - 5.01 KB
File downloaded or viewed 17 time(s)
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sun Feb 12, 2006 2:17 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
if(countdown[1] == 0)
   countdown[1] = 300 //set to 5 minutes

should do the trick as far as resetting the countdown
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Feb 12, 2006 3:49 pm    Post subject: Reply to topic Reply with quote

First of all, there is no double-to-string conversion in MERVBot. You don't need to use a double anyway, just say (reward / 50), and it'll end up as an integer.

But the major problem is that EVENT_Tick doesn't have any parameters associated with it. You can't just do this:
Code: Show/Hide
         int team = *(int*)&event.p[0];
         int reward = *(int*)&event.p[1];

and expect them to magically appear. You're going to have to store the current jp somewhere or look it up when you need to display it.

And now for an optimization: there's no need to set conditions for 60, 120, 180, etc. Just use if (countdown[1] % 60 == 0). The modulus operator (%), in case you don't know, gives the remainder from a division operation. Thus, if a number divides evenly, it will return zero.

And finally, MERVBot is outdated and obsolete. Use ASSS.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
freakmonger
Novice


Joined: Jan 07 2005
Posts: 45
Location: Arlington, VA
Offline

PostPosted: Sun Feb 12, 2006 4:20 pm    Post subject: Reply to topic Reply with quote

More zones use Bots than ASSS so its not 'obsolete'. And he doesnt have the option of using ASSS anyways.
Back to top
View users profile Send private message Add User to Ignore List Send email
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sun Feb 12, 2006 8:19 pm    Post subject: Reply to topic Reply with quote

Obsolescence from Wikipedia:

When a new, more functional product or technology supersedes the old
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Feb 12, 2006 11:21 pm    Post subject: Reply to topic Reply with quote

ASSS is an option to everyone but Trench Wars. If you don't program for Trench Wars, it's an option.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Mon Feb 13, 2006 11:16 am    Post subject: Reply to topic Reply with quote

i dont go use ASSS coz this plugin is for desert storm (explains the !cgive part)
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
freakmonger
Novice


Joined: Jan 07 2005
Posts: 45
Location: Arlington, VA
Offline

PostPosted: Mon Feb 13, 2006 11:22 am    Post subject: Reply to topic Reply with quote

Witchie NL wrote:
i dont go use ASSS coz this plugin is for desert storm (explains the !cgive part)


Like I said, ASSS is not an opition for him. He's not the sysop/owner of that zone and the owner isnt going to use ASSS hence my first statement.......


Obsolete from dictionary.com

No longer in use

last I checked zones still use bots...
Back to top
View users profile Send private message Add User to Ignore List Send email
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Feb 13, 2006 3:10 pm    Post subject: Reply to topic Reply with quote

You would be correct if the context of the word called for the first definition. Unfortunately it does not, try the second definition:
"Outmoded in design, style, or construction"

The first definition is not always right in context biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Feb 13, 2006 9:48 pm    Post subject: Reply to topic Reply with quote

Convince your boss to switch to asss.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Tue Feb 14, 2006 8:43 am    Post subject: hehe Reply to topic Reply with quote

wow if you can get that happen your my big idol and freakmonger knows what i mean with that...
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
freakmonger
Novice


Joined: Jan 07 2005
Posts: 45
Location: Arlington, VA
Offline

PostPosted: Tue Feb 14, 2006 4:50 pm    Post subject: Reply to topic Reply with quote

lol yea witchie, switch to ASSS....good luck with that
Back to top
View users profile Send private message Add User to Ignore List Send email
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 61 page(s) served in previous 5 minutes.

phpBB Created this page in 0.526769 seconds : 46 queries executed (84.9%): GZIP compression disabled