Mirage Source

Free ORPG making software.
It is currently Sun Apr 28, 2024 2:09 am

All times are UTC




Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: News System
PostPosted: Sun Aug 20, 2006 6:03 am 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
Ok after Leighland Posted: Thu Aug 17, 2006 7:35 pm Live/Stats
I started working on a small system that is a text box called txtnews that is suppossed to grab it's info from news.ini but I am unable to get the code to work how it's suppossed to.

1. news =blank
2. admin updates it
3. player logs in
4. news is displayed on main menu

But I can't get the code to work correctly

Ok it's 2:04 am here so I gotta get some sleep later people.

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 6:13 am 
Offline
Pro

Joined: Sat Jun 03, 2006 8:32 pm
Posts: 415
what part are you having trouble with...

adding write news to server...

adding read news to client...

sending from server to client...

?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 9:32 am 
Offline
Newbie

Joined: Fri Aug 18, 2006 3:59 am
Posts: 24
look at how Motd is set up.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 6:06 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
You mean like this

Server Side
Code:
    ' :::::::::::::::::::::
    ' :: Set NEWS packet ::
    ' :::::::::::::::::::::
    If LCase(Parse(0)) = "setNews" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_MAPPER Then
            Call HackingAttempt(Index, "Admin Cloning")
            Exit Sub
        End If
       
        Call PutVar(App.Path & "\data\News.ini", "NEWS", "Msg", Parse(1))
        Call GlobalMsg("News changed to: " & Parse(1), BrightCyan)
        Call AddLog(GetPlayerName(Index) & " changed NEWS to: " & Parse(1), ADMIN_LOG)
        Exit Sub
    End If


Client Side
Code:
Sub SendNEWSChange(ByVal NEWS As String)
Dim packet As String

    packet = "SETNEWS" & SEP_CHAR & NEWS & SEP_CHAR & END_CHAR
    Call SendData(packet)
End Sub

I'm not sure if theres anyother code to it, thats the code I had before but I can't get it to load into the text box on frmMainMenu

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 7:11 pm 
Offline
Newbie

Joined: Fri Aug 18, 2006 3:59 am
Posts: 24
aight im still rusty with vb and mirage been away for too long. But you are not trying to load it into a textbox there, u just sending a packet from client to server to save the news. after it saves send another packet back to the client with the news, and when the client recives the packet, just make it display it in the textbox.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 7:19 pm 
I don't get it, are you trying to do a news box on the main form, or trying to send a message when a player logs in?


Top
  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 11:59 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
Ok let me clear this up, ok that code up there is the code I was using, which as you all said it sends into the client txtChat, I'm sick of that. So I'm trying to figure out the code to make it appear in a text box on the frmMainMenu, but again I can't figure out the code for sending, receiving, and I'm not even sure if I got the saving part right.

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 12:07 am 
I can write you a tut, to pull text from a txt file on a website, or to pull it from a txt file client side, which you can update everytime a player logs on, by making them download it automatically from your server or something.


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 1:27 am 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
Well the idea I was having was to; have it on the server side and edit it through the server or just by writting in it, and then everytime the player logs in they get the new info.

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 1:30 am 
Well, then you send a packet in sub main, to the server, to tell the server you need that data sent back, then you set it up client side, to recieve that packet, and set it to display that packet in a text box.

It really wouldn't be all that hard.


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 1:33 am 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
I've tried something like that but I can't get it right.

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 2:06 am 
I'll try working on it tomarrow, if I get it working, I will post a tut for it.


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 2:31 am 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
Alright, I'll keep trying some other codes, ohh thanks in advance if you get it working. I also found this code. http://www.splamm.com/elysium/forums/vi ... .php?t=523

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 1:59 pm 
Offline
Knowledgeable

Joined: Tue May 30, 2006 5:11 am
Posts: 156
Location: Australia
First thing you need to learn to be able to do this properly is to understand how packets are sent and recieved in Mirage Source.. Once you understand that concept you should be able to do basically anything you need..

I'll quickly run through it now.. I'll use sending hp as an example.. The server gets the players hp and puts it in a packet.. The packet has a simple label.. The packet should look something like this:

"playerhp" & SEP_CHAR & PlayerHp & SEP_CHAR & END_CHAR

Now, as you can see, SEP_CHAR separates the packets individual sections of data. this allows the client to distinguish between what is data and what isnt.. The END_CHAR tells the client when the packet ends.. And well the PlayerHP pretty much speaks for itself.. Now, This is still server side.. By default mirage sends all packets as strings.. So you use the SendData method (oh god im turning all java.. arghh.. i hate the word method) to send the packet from the server to the client..

Now client side.. When a packet is recieved it runs the HandleData method.. (Arghh again with the method) Anyway, the first thing you need to do, is add in a nice little section, and If statement by default, to check to see if your PlayerHP packet has arrived. Now if you remember from the top section, our packet was called playerhp.. So you just go If packet name = playerhp then update label.. Thats basically it..

Once you understand this concept, you will be able to send data to the client from the server and vice versa.. Happy coding.. :wink:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 3:51 pm 
Posted the tut for pulling the news from a url. I will work on the other one later.


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 3:52 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
you mean pulling the news from a website?

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 3:54 pm 
Yes, pretty much. You upload a text file to your website, and you use the link for it in the client, it will pull all the text from that file, and put it in a text box.


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 3:57 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
ok, I'll still keep trying out stuff so I can edit on server side and view on client side

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 4:01 pm 
That's not hard to do, and I will get that one finished later. ^^


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 4:03 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
ok well if not I'll make some mods to the one you have on there now and see what comes out

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 4:11 pm 
Well, that method is for only pulling it from a url.

The one I'm working on now, you type out the news on the main server form, and then click send, and it will send, and it will send it to the client, and save it client side in a text file. When the client is ran, it will check the contents of news.txt client side, against the news server side, and if it is different, it will pull the new, news and display it. ^^


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 4:16 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
Well, I'll probably wind up using your tut anyway, but I'm still going to try and figure out the code.

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 4:43 pm 
The tut I already posted, will work fine, and will be easier for other staff to edit the news.

The method you want, requires making the client connect on frmMainMenu, so that you CAN send packets (At least, seems so to me, I could be wrong), which is something I don't feel like doing.

Sooner or later, I will get a tut out for this, but imo, the tut I already posted, should do perfectly fine.


Top
  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 4:49 pm 
Offline
Knowledgeable
User avatar

Joined: Tue May 30, 2006 1:42 am
Posts: 346
Location: Florida
Alright well if you feel like writting the other one it's cool. Ok I found a code that's similar to what I want but still can't get the text to blit intothat freaking starting textbox.

here's the code;
client side:
Code:
   
    ' :::::::::::::::::::::::::::::::::
    ' ::     News Recieved packet    ::
    ' :::::::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "news" Then
        Call WriteINI("DATA", "News", Parse(1), (App.Path & "\News.ini"))
        Exit Sub
    End If

ServerSide
Code:
Sub SendNewsTo(ByVal index As Long)
Dim Packet As String

    Packet = "NEWS" & SEP_CHAR & ReadINI("DATA", "ServerNews", App.Path & "\News.ini") & SEP_CHAR & END_CHAR
   
    Call SendDataTo(index, Packet)
End Sub
think that theres anything else that I should do to make it show the words in the text box?

_________________
shut your manpleaser
http://www.kazmostech.com


Top
 Profile  
 
 Post subject: Re: News System
PostPosted: Tue Nov 02, 2021 4:51 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489994
Prem215.6CHAPReprStorGirlCafePietSingDaviFlowJeweWisaWassIndiSidnEdgaAlleWilsTorrXVIINULLMary
XIIIKrzyOxygDerePurcDougBrenEricTracPantSticBosqFortGezaPoulRudyXVIIAuroMatiSwalMaltHannJorg
PatrZoneKaraLeanVoguLighLycrPeteCircFallNikiHeggOmsaIronJameJeffJaneBabyJohnJoanAndaBoriRadi
CollEdgaHeatGillRobeSelaElemWindAlfrELEGOrieSileMariTellMichOverZoneUtsuArtsJaneTraiZoneGrea
ZoneZoneEverZoneZoneZoneAlesdiamZoneIsaoZoneZoneZoneZoneZoneStanCanoZonelsbkAnnaMinuZoneHapp
ZoneFabrGerhNokiCaulSamsNeveAtlaBookMcDoOscaRambGeerBeflRenzDonaMistSTARSonyKenwKareThistrac
IvreValiNDFESemcLegeIrinOutlWindPoweSaleAnimPanaLighSergYarrHereGrinManafantProlMariLikeAbov
AcadXVIIMigjSmokHoheMartJackJackCharGottWaltNapoMMORJudaJeweThisMineMariCarmMichJeffSPECGuid
wwwaStevLawrXXVIPunkBeasBlacCavestaiwwwnLeftHansWhatToveOverIcedfranAnimEnjoBetsDisnNokiNoki
NokiAdobGleeMorgSonyClouCyprMusiBirtConnPaolGracJohntuchkasEnidShin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group