Vice City: Multiplayer

Server Development => Scripting and Server Management => Client Scripting => Topic started by: rulk on May 03, 2016, 03:38 PM

Title: sprite covering the whole screen
Post by: rulk on May 03, 2016, 03:38 PM
I'm not sure of I've missed it in the docs, but how do I get a sprite to cover the entire screen.

// works but does not cover the entire display
Logo <- GUISprite( "squirrel_logo.jpg", VectorScreen( 100, 100 ) );
Title: Re: sprite covering the whole screen
Post by: Drake on May 03, 2016, 03:40 PM
Logo <- GUISprite( "squirrel_logo.jpg", VectorScreen( GUI.GetScreenSize().X, GUI.GetScreenSize().Y ) );
Title: Re: sprite covering the whole screen
Post by: rulk on May 03, 2016, 03:59 PM
that dosn't work for me, is that how we do it ?
Title: Re: sprite covering the whole screen
Post by: DizzasTeR on May 03, 2016, 04:34 PM
sX <- GUI.GetScreenSize().X;
sY <- GUI.GetScreenSize().Y; // Add on top.

Logo <- GUISprite( "squirrel_logo.jpg", VectorScreen( 0, 0) );
Logo.Size = VectorScreen( sX, sY );
Title: Re: sprite covering the whole screen
Post by: rulk on May 03, 2016, 04:42 PM
worked a charm, thanks
Title: Re: sprite covering the whole screen
Post by: . on May 03, 2016, 04:43 PM
Quote from: rulk on May 03, 2016, 03:59 PMthat dosn't work for me, is that how we do it ?

Because the second parameter is the position. And you set the position as the screen dimension then the sprite will be positioned after the lower right corner of the screen. Therefore, it doesn't appear on screen.

First you create it on position 0,0:

Logo <- GUISprite("squirrel_logo.jpg", VectorScreen(0, 0));
Then you set the total size of the sprite equal to the screen size:
Logo.Size = GUI.GetScreenSize();
If you want to scale the image as well:
Logo.TextureSize = GUI.GetScreenSize();


EDIT: Sorry, it seems a similar post was made while I was posting this.
Title: Re: sprite covering the whole screen
Post by: rulk on May 03, 2016, 05:16 PM
I preffer S.L.C's version but dooms works perfect.

Anyhow, I am having trouble removing the GUISprite now. I'm getting
AN ERROR HAS OCCURED [trying to set 'class']

what am I doing wrong ?

http://pastebin.com/raw/rhFqTCuG
Title: Re: sprite covering the whole screen
Post by: . on May 03, 2016, 05:27 PM
You'll find some decent insight in this discussion (http://forum.vc-mp.org/?topic=2752.msg20532#msg20532). Basically, you have to prefix your global variables/functions with :: all the time.

When you create it:
::Logo <- GUISprite("squirrel_logo.jpg", VectorScreen(0, 0));
And when you use it:
::Logo = null;
Otherwise it's created as a member of the class in which it was executed. Take the following example:

function Script::ScriptLoad()
{
    Logo <- GUISprite("squirrel_logo.jpg", VectorScreen(0, 0));
}

Do you think that's created in the root table? Think again:

function Script::ScriptLoad()
{
    Logo <- GUISprite("squirrel_logo.jpg", VectorScreen(0, 0));
    print(getroottable().rawin("Logo")); // false
}

It's actually created as a member of the Script class.
function Script::ScriptLoad()
{
    Logo <- GUISprite("squirrel_logo.jpg", VectorScreen(0, 0));
    print(Script.rawin("Logo")); // true
}

Therefore you have to use:
Script.Logo = null
Whenever you wish to access that variable. Unless, you prefixed it with :: when you created it and every time you used it after that.



Ask @maxorator , he knows more about this. :P
Title: Re: sprite covering the whole screen
Post by: Stormeus on May 03, 2016, 09:45 PM
I'd consider it poor convention to declare a global variable from inside a function anyway. You should be declaring your global variables at the top of the script and then referencing them.

Logo <- null;
function Script::ScriptLoad()
{
    Logo = GUISprite("squirrel_logo.jpg", VectorScreen(0, 0));
}

This works as expected and is unambiguous.
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 20, 2016, 05:38 PM
and what about textdraws?
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 20, 2016, 05:49 PM
Quote from: MEGAMIND on Jul 20, 2016, 05:38 PMand what about textdraws?
what about searching a bit?
http://forum.vc-mp.org/?topic=2719.msg20159#msg20159
That topic has every function listed.
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 20, 2016, 05:52 PM
sry sir but i cant still .....can u plzz just give me the exact code if possible?
Title: Re: sprite covering the whole screen
Post by: DizzasTeR on Jul 20, 2016, 05:54 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fguyanachronicle.com%2Fwp-content%2Fuploads%2F2014%2F08%2Fbegging-pr-agency.jpg&hash=7e38b8b3dad69b242dde0c3b272d16b278a9d086)

Spreading hands, calling members 'Sir' and saying 'plzz' won't give you anything.
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 20, 2016, 05:58 PM
I no longer script in VCMP :p
but, you can give a try to GUIMemobox
GUIMemobox

Constructor GUIMemobox()

Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour

Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int

Function AddLine(line)
Parameter types: string. Return type: void.

Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.

Function Clear()
Return type: void.

Property DisplayPos
Type: float

Property LineHeight
Type: int

Property LineCount (read-only)
Type: int

Property HistorySize
Type: int
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 20, 2016, 06:01 PM
Quote from: Doom_Kill3R on Jul 20, 2016, 05:54 PM(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fguyanachronicle.com%2Fwp-content%2Fuploads%2F2014%2F08%2Fbegging-pr-agency.jpg&hash=7e38b8b3dad69b242dde0c3b272d16b278a9d086)

Spreading hands, calling members 'Sir' and saying 'plzz' won't give you anything.
im not spreaddiing hands im just giving him respect
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 20, 2016, 06:01 PM
Quote from: KAKAN on Jul 20, 2016, 05:58 PMI no longer script in VCMP :p
but, you can give a try to GUIMemobox
GUIMemobox

Constructor GUIMemobox()

Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour

Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int

Function AddLine(line)
Parameter types: string. Return type: void.

Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.

Function Clear()
Return type: void.

Property DisplayPos
Type: float

Property LineHeight
Type: int

Property LineCount (read-only)
Type: int

Property HistorySize
Type: int
what does it do actually
Title: Re: sprite covering the whole screen
Post by: Thijn on Jul 20, 2016, 06:26 PM
Quote from: MEGAMIND on Jul 20, 2016, 06:01 PM
Quote from: KAKAN on Jul 20, 2016, 05:58 PMI no longer script in VCMP :p
but, you can give a try to GUIMemobox
GUIMemobox

Constructor GUIMemobox()

Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour

Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int

Function AddLine(line)
Parameter types: string. Return type: void.

Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.

Function Clear()
Return type: void.

Property DisplayPos
Type: float

Property LineHeight
Type: int

Property LineCount (read-only)
Type: int

Property HistorySize
Type: int
what does it do actually
Coding a snippet using those is like 5mins of work. So instead of you asking what something does, try it out :)
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 20, 2016, 06:52 PM
where to add this thing sir
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 21, 2016, 09:06 AM
Quote from: MEGAMIND on Jul 20, 2016, 06:52 PMwhere to add this thing sir
Create a file called main.nut
And put that file in yourserver/store/scripts
Then, put this inside that file:-
Memo <- GUIMemoBox( VectorScreen(1280,720), VectorScreen(10,10), Colour(0,1,0) );
//Check the syntax, it might not be correct.
Memo.AddLine( " My new FOcking textdraw!");
Memo.AddLine( "Another line bich");
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 21, 2016, 09:31 AM
will i have to make a dofile in my main.nut to run dofile( "Store/Scripts/main.nut" ); ?
if not sir i think ur sysntax is wrong im  new at this thing so please guide step by step
Title: Re: sprite covering the whole screen
Post by: DizzasTeR on Jul 21, 2016, 09:44 AM
Quote from: MEGAMIND on Jul 21, 2016, 09:31 AMwill i have to make a dofile in my main.nut to run dofile( "Store/Scripts/main.nut" ); ?
if not sir i think ur sysntax is wrong im  new at this thing so please guide step by step

First of all its not 'Store' its 'store', also its 'script' folder not 'Scripts. Now.... You won't need to add the dofile( "store/scripts/main.nut" ) in your main scripts.

You just add a main.nut in store/script/here and then do your client-side scripts in there
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 21, 2016, 10:07 AM
is that how we do it

GUIMemobox

Constructor GUIMemobox()

Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour
Memo <- GUIMemoBox( VectorScreen(1280,720), VectorScreen(10,10), Colour(0,1,0) );

Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int

Function AddLine(line)
Parameter types: string. Return type: void.
Memo.AddLine( " My new FOcking textdraw!");

Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.
Memo.AddLine( "Another line bich");

Function Clear()
Return type: void.

Property DisplayPos
Type: float

Property LineHeight
Type: int

Property LineCount (read-only)
Type: int

Property HistorySize
Type: int

 function Script::ScriptLoad( ) {

LoadScript( "main.nut" );
dofile( "main.nut" );
include( "main.nut" );
Console.Print("Hello World!");
print( "Client side scripts loaded." );
Console.Print( GetTicks( ).tostring( ) );

}
function Script::ScriptUnload()
{
    Console.Print("Disconnect!");
}

 function Player::PlayerDeath( player ) {

Console.Print( player.Name + " has died." );

}

kindly help im new at  this side
Title: Re: sprite covering the whole screen
Post by: Finch Real on Jul 21, 2016, 10:09 AM
Pls Use Code Button
Title: Re: sprite covering the whole screen
Post by: Thijn on Jul 22, 2016, 06:02 AM
No that's not how you do it. You just copy pasted the documentation. If you had any sense of coding you would see the syntax is all wrong.

Copy what @KAKAN has posted and see what it does.
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 06:15 AM
Quote from: KAKAN on Jul 21, 2016, 09:06 AM
Quote from: MEGAMIND on Jul 20, 2016, 06:52 PMwhere to add this thing sir
Create a file called main.nut
And put that file in yourserver/store/scripts
Then, put this inside that file:-
Memo <- GUIMemoBox( VectorScreen(1280,720), VectorScreen(10,10), Colour(0,1,0) );
//Check the syntax, it might not be correct.
Memo.AddLine( " My new FOcking textdraw!");
Memo.AddLine( "Another line bich");
i did the same thing and nothing happens
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 22, 2016, 08:50 AM
Sorry, paste it in store/script and not store/scripts
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 12:50 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi67.tinypic.com%2F2qiwd42.jpg&hash=853b7daff139df20d9c1444588f1d92910b0835a)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi64.tinypic.com%2F2eye7lx.jpg&hash=1d61e1cdfd13e6870a5e7f20c6887e474bc77ab8)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi68.tinypic.com%2F2eppt8m.jpg&hash=ae73e7ca887c0c4dad43899136e81cde2980786b)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi67.tinypic.com%2Fotngpd.jpg&hash=3ee896e4110dbfa0adbe8a7047639e8aadfd96a5)

tell me if i am mistakened or if any new version available and plugins
Title: Re: sprite covering the whole screen
Post by: DizzasTeR on Jul 22, 2016, 01:01 PM
Should be like this:
Logo <- null;
Memo <- null;

function Script::ScriptLoad() {
    Logo = GUISprite( "squirrel_logo.png", VectorScreen( 0, 0 ) );
    // Logo.Size = VectorScreen( Width, Height ) // You can resize the sprite
    Memo <- GUIMemobox( VectorScreen( 1221, 700 ), VectorScreen( 10, 10 ), Colour( 255, 255, 255, 255 ) );
    Memo.AddLine( "First line" );
    Memo.AddLine( "Second line" );
}
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 01:19 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi64.tinypic.com%2Fjsdftc.jpg&hash=826be4079a8a0b34d72a73ab586973897553f2fa)

this happened to me when i updated plugins form here http://forum.vc-mp.org/?board=4.0

and  know i got thses errors if any new version or plugin available kindly provide link

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi66.tinypic.com%2Fa2823c.jpg&hash=495b59400265bd0c8039a354469a2e4341b5865f)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi63.tinypic.com%2F9kw4mt.jpg&hash=8324a1efe78c61a4cb716315474fa143cc1b6d24)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi68.tinypic.com%2F1b3h4.jpg&hash=e2660a4db7e26e0f1d3f7c3ad5666d5e9fab3b0b)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi68.tinypic.com%2F141m4go.jpg&hash=557203c6cd27e46868e279893aa3041438c7362d)
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 22, 2016, 03:22 PM
Just remove that plugin from server.cfg file and you're good to go.
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 04:38 PM
not working i also tested on blank gamemode script still not working did all the things same way u guyzz told
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 04:56 PM
a video maybe helpfull if u provide
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 22, 2016, 05:17 PM
Quote from: MEGAMIND on Jul 22, 2016, 04:56 PMa video maybe helpfull if u provide
@Megamind, set the textdraw according to your resolution.
Title: Re: sprite covering the whole screen
Post by: DizzasTeR on Jul 22, 2016, 05:37 PM
@MEGAMIND, What I see in the screenshots you provided, squirrel_logo.jpg

VCMP only loads images of format .png and not .jpg
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 05:44 PM
ok thnx but plz if we proviede will be helpfull
=============================
know im really desup and giveup know i really need a video plzz
Title: Re: sprite covering the whole screen
Post by: Stormeus on Jul 22, 2016, 05:50 PM
We're not implementing JPEG sprites. It's generally useless for games and a superfluous use of development time. Just convert your images.
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 06:23 PM
will it work like in sebys video /exec s<-CreateSpritre...etc?
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 06:33 PM
i did this in my

C:\Users\Administrator\Desktop\Blank VCMP 0.4 Server 32(x86) - 05.05.2016\store\script\main.nut

GUIMemobox
Constructor GUIMemobox()
Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour
Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int
Function AddLine(line)
Parameter types: string. Return type: void.
Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.
Function Clear()
Return type: void.
Property DisplayPos
Type: float
Property LineHeight
Type: int
Property LineCount (read-only)
Type: int
Property HistorySize
Type: int
Logo <- null;
Memo <- null;

function Script::ScriptLoad() {
    Logo = GUISprite( "images_logo.png", VectorScreen( 10, 10 ) );
    // Logo.Size = VectorScreen( Width, Height ) // You can resize the sprite
    Memo <- GUIMemobox( VectorScreen( 108, 700 ), VectorScreen( 10, 10 ), Colour( 255, 255, 255, 255 ) );
    Memo.AddLine( "hi all" );
    Memo.AddLine( "testing" );
}

server.cfg
plugins squirrel04rel32 xmlconf04rel32 announce04rel32 hashing04rel32 ini04rel32 mysql04rel32 sockets04rel32 sqlite04rel32


where is the problem????????

my pc screen resolutoion is 1280x1024 and game resolution is 640x480x32
Title: Re: sprite covering the whole screen
Post by: Stormeus on Jul 22, 2016, 06:44 PM
Your problem is you keep pasting the documentation into your code when it doesn't do anything and isn't valid code.

Remove this:
GUIMemobox
Constructor GUIMemobox()
Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour
Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int
Function AddLine(line)
Parameter types: string. Return type: void.
Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.
Function Clear()
Return type: void.
Property DisplayPos
Type: float
Property LineHeight
Type: int
Property LineCount (read-only)
Type: int
Property HistorySize
Type: int
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 06:46 PM
Quote from: Stormeus on Jul 22, 2016, 06:44 PMYour problem is you keep pasting the documentation into your code when it doesn't do anything and isn't valid code.

Remove this:
GUIMemobox
Constructor GUIMemobox()
Constructor GUIMemobox(position, size, colour)
Parameter types: VectorScreen, VectorScreen, Colour
Constructor GUIMemobox(position, size, colour, flags)
Parameter types: VectorScreen, VectorScreen, Colour, int
Function AddLine(line)
Parameter types: string. Return type: void.
Function AddLine(line, colour)
Parameter types: string, Colour. Return type: void.
Function Clear()
Return type: void.
Property DisplayPos
Type: float
Property LineHeight
Type: int
Property LineCount (read-only)
Type: int
Property HistorySize
Type: int

but when i remove it it still doesnot works???? know wheres the problem
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 22, 2016, 07:41 PM
new question when in store\script\main.nut
function Script::ScriptLoad()
{
print( "Testing..." );
}

why in console it not showing this print in console do we have to link our scripts together do we have to link our main.nut with store\script\main.nut?
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 23, 2016, 02:28 AM
OH THANKU SO MUCH I DONT KNOW HOW TO THANKU GUYZZZZ VCMP 0.4 ROCKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS IT WORKED YEA....

sX <- GUI.GetScreenSize().X;
sY <- GUI.GetScreenSize().Y;

function Script::ScriptLoad()
{
Logo <- GUISprite( "Penguins.jpg", VectorScreen( 50, 50) );
Logo.Size = VectorScreen( sX, sY );
}

IT WORKED THANKS SPECIALLY TO @Doom_Kill3R

but  this is much better
Logo <- null;
function Script::ScriptLoad()
{
Logo <- GUISprite( "Penguins.ico", VectorScreen( 10, 200) );
} guess what it can work with any extension

i got them both working by this method sprite n textdraws
Memo <- null;
Logo <- null;
function Script::ScriptLoad()
{
  Memo <- GUIMemobox( VectorScreen( 1000, 500 ), VectorScreen( 100, 100 ), Colour( 255, 202, 202, 255 ) );
    Memo.AddLine( "hi testing" );
    Memo.AddLine( "Second line" );
Logo <- GUISprite( "Penguins.ico", VectorScreen( 10, 200) );
}
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 23, 2016, 11:46 AM
ok every thing is good but i dont need the box i onlu need text what should i do
Title: Re: sprite covering the whole screen
Post by: Luis_Labarca on Jul 24, 2016, 07:21 PM
Quote from: MEGAMIND on Jul 22, 2016, 07:41 PMnew question when in store\script\main.nut
function Script::ScriptLoad()
{
print( "Testing..." );
}

why in console it not showing this print in console do we have to link our scripts together do we have to link our main.nut with store\script\main.nut?

hey bro also have the probe problem and I do not get anything on the console that needs to be done?
Title: Re: sprite covering the whole screen
Post by: MEGAMIND on Jul 24, 2016, 09:06 PM
Exactly
Title: Re: sprite covering the whole screen
Post by: KAKAN on Jul 25, 2016, 08:38 AM
Quote from: MEGAMIND on Jul 24, 2016, 09:06 PMExactly
Go to: %appdata%\vcmp\04beta and open the debuglog.txt file, it should be there and not in your console. And also, make sure that you've named the folder script and not scripts