Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   scripting trouble -.- (https://forums.graalonline.com/forums/showthread.php?t=60888)

excaliber7388 08-31-2005 02:01 AM

scripting trouble -.-
 
Whats wrong with this script? It works fine offline. It should play a song thats in your graal folder, so people can use it like an MP3 player :D

NPC Code:
//#CLIENTSIDE
if(playerchats&&startswith(/play,#c)){
setstring clientr.song,#T(#e(5,-1,#c));
play #s(clientr.song)
}


Torankusu_2002 08-31-2005 02:06 AM

clientr. strings can only be changed serverside, read clientside.

You would have to use regular client. strings, or access it serverside.

My suggestion is that in the future, if you are trying to script simple things and use client strings, use regular client.strings. However, if you're going for things you don't want to be changed by 3rd party programs (hex editors, or whatever,) then I suggest using clientr.strings. Example: clientr.rupees, clientr.fullhearts, or something of the sort. Get it?

Maniaman 08-31-2005 02:13 AM

Why the #T()?

Lance 08-31-2005 02:16 AM

Quote:

Originally Posted by Maniaman
Why the #T()?

It trims whitespace. So he could say, for example, '/playfilename' or '/play filename'.

Torankusu_2002 08-31-2005 02:16 AM

Quote:

Originally Posted by Maniaman
Why the #T()?

trims the space.
basically what lance said, i just took to long.

--edited.

Maniaman 08-31-2005 02:18 AM

Ah, ok.

Bl0nkt 08-31-2005 02:20 AM

NPC Code:
if (actionserverside) { 
if (strequals(#p(0),playsong)) {
setstring clientr.song,strtofloat(#p(1));
play #s(clientr.song);
}
}

//#CLIENTSIDE
if (playerchats && startswith(/play,#c) && tokenscount == 2) {
tokenize #c;
triggeraction 0,0,serverside,playsong,#t(1);
}



I believe this is right.

Lance 08-31-2005 02:26 AM

Quote:

Originally Posted by Bl0nkt
NPC Code:
if (actionserverside) { 
if (strequals(#p(0),playsong)) {
setstring clientr.song,strtofloat(#p(1));
play #s(clientr.song);
}
}

//#CLIENTSIDE
if (playerchats && startswith(/play,#c) && tokenscount == 2) {
tokenize #c;
triggeraction 0,0,serverside,playsong,#t(1);
}



I believe this is right.

No. You cannot use the play command serverside.

excaliber7388 08-31-2005 02:40 AM

it works now :D i made it client.song instead of clientr.song :D thx!

Torankusu_2002 08-31-2005 02:44 AM

Quote:

Originally Posted by excaliber7388
it works now :D i made it client.song instead of clientr.song :D thx!

no problem.
just keep in mind what i said.


All times are GMT +2. The time now is 09:13 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.