Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / MultiSync help.

Author
Message
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 1st Sep 2006 19:09
OK,im trying to let my program write a file with username as filename,and password inside it.BUT then i only get an empty names .plr file.only called .plr...

Well heres my servers code:



And my clients:


WHAT am i missing?

FPSC-Toolkit in the make.Progress log:
FPSC-Segments 35%---FPSC-Entity 's 0%---FPSC-Signs 0%
FPSC-Decals 0%---FPSC Characters 0%
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 2nd Sep 2006 17:00
BUMP...i need to know!

FPSC-Toolkit in the make.Progress log:
FPSC-Segments 35%---FPSC-Entity 's 0%---FPSC-Signs 0%
FPSC-Decals 0%---FPSC Characters 0%
Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 2nd Sep 2006 21:01
So, you want to make a file, call it "username.plr", and put the password inside.

What does this have to do with multiplayer? To make it simpler for the people who are here to help you, why don't you just show us the code that actually does this... which means, don't post all the multiplayer code too...

Harvard's Law, as Applied to Computers:
Under the most rigorously controlled conditions of pressure, temperature, volume, humidity and other variables, the computer will do as it d*mn well pleases.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 2nd Sep 2006 21:57
...

i just pasted everything,because i think theres something wrong with retreving the name of the account and write the file.thats why i posted everything.

FPSC-Toolkit in the make.Progress log:
FPSC-Segments 35%---FPSC-Entity 's 0%---FPSC-Signs 0%
FPSC-Decals 0%---FPSC Characters 0%
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 2nd Sep 2006 22:21 Edited at: 2nd Sep 2006 22:21
@Accel Leon, just a few quick general DB-related pointers::

Translation: This is why your code is borked

Val() returns an integer, and is one way ONLY.
Where you do:
Quote: "
val(Pass$) = net pop float()
val(Name$) = net pop float()
"

.. isn't valid. You cannot assign a floating point integer representation to a function like that; They're one way.
Val() is designed ONLY to return an integer, from a string you pass.

And another thing on the use of Val(); It reads the string and tries to turn it into a number.

You attempt to use the code as if to turn the string into an integer represenation, and then back again; You cannot do this.
Val()'s designed for parsing integers that are written into strings; Like Val("12345") would return an integer with the value 12345. That's all.

It can't do miracles


---

Ook, and ints in general:

Quote: "
Function SendOk()
Number# as integer
OK# as integer
Number#=val("2")
OK#=val("Account created,you can now login")
net push float Number#
net push float OK#
net send 1
inc PACKETS_SENT
endfunction"


Let's work through this. I won't touch the MultiSync-specific stuff, as that's Benjamin's domain.

'Number# as integer' DOES NOT make sense. # means that the number is a float; Float(ing point integer) != (normal) Integer.

The #,$ symbols effectively mean 'as float' and 'as string' respectively.
You use either the symbols on the end of the vars (have to in DBC), OR the as <type> declaration.

So:
Number as integer

Will do you fine. ^^


-----

Quote: "
OK# as integer
Number#=val("2")
OK#=val("Account created,you can now login")
"


Hopefully you should see where you're going wrong with this bit now

Number#=val("2")? Technically valid code, but you don't want Number# as a float because you haven't got a decimal point.
Numbers without decimal points, use Integers.

Quote: "
Number as integer
Number = 2
"


Val() only needs to be used for very special cases (finding numbers in written text). Just use the above code, as you can assign integers directly to their values!

And, finally, OK#.
You imply it's a float by using #, you use 'as integer' to contradict yourself and say it's actually an integer... And then you assign a string's value to it. o_o

OK As String, or OK$.
Remember that in DB you don't have to declare your variables! It's good practise, but you don't need to.

Both of the following are correct (but require that you choose what to call your var, depending on your style (or lack of it)):

Methos 1
Quote: "
OK As String
OK = "Account created, you can now login."
"


Methos 2
Quote: "
Rem Variable implicitly declared
OK$ = "Account created, you can now login."
"


Well, have fun! Fixing up the rest of your code in this manner will fix the problem anyway, I think....

Because you know how Val() pulls written numbers out of text?
What happens if you use Val("SomeWriting")?

0, that's what.

Well. Enjoy.

-=-=- Activate asshat mode. -=-=-
Warning: This post may contain bloatage.
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 2nd Sep 2006 22:34 Edited at: 2nd Sep 2006 22:35
I haven't got time right this second to look at all of the code, but I will explain one of the mistakes you have made right now.

Let's start with this function:



What you should be doing is calling net receive to buffer the
messages, then getting the amount of messages from net_getmsgamount so that you can then read through all of them by using a for/next loop. For example:



I'll check out the rest of the code when I have time.

Tempest - P2P UDP Multiplayer Plugin (DBP/DBCe)
Download the free version
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 2nd Sep 2006 22:35
ill debug that tommorow,thanks for helping.im new in Multiiplayer...and this is V0.00001 of my server app...and my first attempt at a server app...

FPSC-Toolkit in the make.Progress log:
FPSC-Segments 35%---FPSC-Entity 's 0%---FPSC-Signs 0%
FPSC-Decals 0%---FPSC Characters 0%
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 3rd Sep 2006 15:50
This doesnt work either:




I am the warrior Maximilious.One of the Assasins of Guild Wars...
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 3rd Sep 2006 21:15
The problem is that you are trying to put the name and password in the message as floats, when they are infact strings. Use net push string to put strings in the message.

Tempest - P2P UDP Multiplayer Plugin (DBP/DBCe)
Download the free version
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 3rd Sep 2006 21:33 Edited at: 3rd Sep 2006 21:36
i feel so stupid...

ill try it.

EDIT:

and how to use the:



?


I am the warrior Maximilious.One of the Assasins of Guild Wars...
Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 5th Sep 2006 17:21
Quote: "The problem is that you are trying to put the name and password in the message as floats, when they are infact strings. Use net push string to put strings in the message.
"


ive found using net push/pop sting commands made my server crash...

Quote: "Number# = net pop string(Number#)"


i dont think you need to define a value in the net pop string command
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 5th Sep 2006 17:58
if i use

Number# = net pop string()

it cant compile...with that it cant compile either,ot just doesnt work...

(""(o_o)(""
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 5th Sep 2006 18:40
Because Number# is a float point variable, that can only hold numbers, and net pop string() returns a string...



Will fill the Number$ variable with whatever was sent. To turn this number, assuming the string only contains numbers, into an actual number, use;



And now Number#, which is a different variable from Number$, holds the actual number data of the string.

I know you probably wont listen but if you havent grasped the concept of different types of variables yet, looking into something as complex as data transfer might not be the best next step to take.

Your signature has been erased by a mod because it's larger than 600x120...
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 5th Sep 2006 20:09
Quote: "I know you probably wont listen but if you havent grasped the concept of different types of variables yet, looking into something as complex as data transfer might not be the best next step to take.
"


im more used to the basic variable: Variable$

the other ones i havent experimented with yet.

ill try your way

(""(o_o)(""

Login to post a reply

Server time is: 2024-11-26 11:24:56
Your offset time is: 2024-11-26 11:24:56