Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-09-2011, 02:04 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
error in RC with gui

hey guys i was testing around with gui scripting and somehow i could have done 2 warping buttons

now i found a script which has a warper menu so i tested around that and after a while i got a problem. the RC keeps saying:

error: missing semicolon at line 5: setlevel2 callimap_c1.nw,10,10;
<b>error: missing semicolon at line 10: setlevel2 level2.nw,35,34;
<b>error: missing semicolon at line 15: setlevel2 level3.nw,35,44;
<b>error: missing semicolon at line 20: setlevel2 level4.nw,32,32;
<b>error: missing semicolon at line 25: setlevel2 level5.nw,29,25;

i could find any mistake so i copied the setlevel2 from other gui button (which worked) but it still keeps saying that. can anyone help?

and the scripts are:
PHP Code:
function onActionServerSide(action) {
  switch (
action) {
    case 
"Warp000":
    
setlevel2 callimap_c1.nw,10,10;
      
player.dir 2;
      
player.chat "Warped to the OSL!";
    break;
    case 
"Warp001":
      
setlevel2 level2.nw,35,34;
      
player.dir 2;
      
player.chat "Warped";
    break;
    case 
"Warp002":
      
setlevel2 level3.nw,35,44;
      
player.dir 2;
      
player.chat "Warped";
    break;
    case 
"Warp003":
      
setlevel2 level4.nw,32,32;
      
player.dir 2;
      
player.chat "Warped";
    break;
    case 
"Warp004":
      
setlevel2 level5.nw,29,25;
      
player.dir 2;
      
player.chat "Warped";
    break;
  }
}
//#CLIENTSIDE
function onCreated() {
//starting from here is gui and so on



or should i use the triggerserver?

-callimuc
Reply With Quote
  #2  
Old 01-09-2011, 02:47 PM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to behold
Quote:
Originally Posted by callimuc View Post
hey guys i was testing around with gui scripting and somehow i could have done 2 warping buttons

now i found a script which has a warper menu so i tested around that and after a while i got a problem. the RC keeps saying:

error: missing semicolon at line 5: setlevel2 callimap_c1.nw,10,10;
<b>error: missing semicolon at line 10: setlevel2 level2.nw,35,34;
<b>error: missing semicolon at line 15: setlevel2 level3.nw,35,44;
<b>error: missing semicolon at line 20: setlevel2 level4.nw,32,32;
<b>error: missing semicolon at line 25: setlevel2 level5.nw,29,25;

i could find any mistake so i copied the setlevel2 from other gui button (which worked) but it still keeps saying that. can anyone help?

and the scripts are:
PHP Code:
function onActionServerSide(action) {
  switch (
action) {
    case 
"Warp000":
    
setlevel2 callimap_c1.nw,10,10;
      
player.dir 2;
      
player.chat "Warped to the OSL!";
    break;
    case 
"Warp001":
      
setlevel2 level2.nw,35,34;
      
player.dir 2;
      
player.chat "Warped";
    break;
    case 
"Warp002":
      
setlevel2 level3.nw,35,44;
      
player.dir 2;
      
player.chat "Warped";
    break;
    case 
"Warp003":
      
setlevel2 level4.nw,32,32;
      
player.dir 2;
      
player.chat "Warped";
    break;
    case 
"Warp004":
      
setlevel2 level5.nw,29,25;
      
player.dir 2;
      
player.chat "Warped";
    break;
  }
}
//#CLIENTSIDE
function onCreated() {
//starting from here is gui and so on



or should i use the triggerserver?

-callimuc
It's expecting there to be no spaces between "setlevel2", and where it's going to, as such thinks that the "setlevel2" part is missing a semicolon. You're mixing GS1 with GS2. The GS2 format for setLevel2 is, using one of your lines for example:

PHP Code:
    case "Warp000":
      
player.setLevel2("callimap_c1.nw"1010);
      
player.dir 2;
      
player.chat "Warped to the OSL!";
    break; 
As you can see, the format for setLevel2() is ReferenceObject.setLevel2("LevelNameInQuotes.nw", X, Y);
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #3  
Old 01-09-2011, 03:14 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Although not relevant to your problem, there is a lot of duplication in there. It might be a good idea to abstract out the repeated code into a function.
Reply With Quote
  #4  
Old 01-09-2011, 04:04 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by TSAdmin View Post
It's expecting there to be no spaces between "setlevel2", and where it's going to, as such thinks that the "setlevel2" part is missing a semicolon. You're mixing GS1 with GS2. The GS2 format for setLevel2 is, using one of your lines for example:

PHP Code:
    case "Warp000":
      
player.setLevel2("callimap_c1.nw"1010);
      
player.dir 2;
      
player.chat "Warped to the OSL!";
    break; 
As you can see, the format for setLevel2() is ReferenceObject.setLevel2("LevelNameInQuotes.nw", X, Y);
ah ok i had the setlevel2("blabla",10,10); but without player.setlevel2("blabla",10,10); but it still wont wor, but i dont have any errors now




Quote:
Originally Posted by Codein View Post
Although not relevant to your problem, there is a lot of duplication in there. It might be a good idea to abstract out the repeated code into a function.
so do u mean i should make like:
PHP Code:
function onCreated() {
//blabla
  
Warp000();
}
function 
Warp000() {
//or function onWarp000() { i have seen this two what should i use
//blabla

Reply With Quote
  #5  
Old 01-09-2011, 04:36 PM
gwFCCtennis gwFCCtennis is offline
Chaotic
gwFCCtennis's Avatar
Join Date: Aug 2010
Location: VA
Posts: 229
gwFCCtennis is on a distinguished road
Send a message via AIM to gwFCCtennis
Now calli, where have I seen this script before....
Reply With Quote
  #6  
Old 01-09-2011, 06:56 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by callimuc View Post
ah ok i had the setlevel2("blabla",10,10); but without player.setlevel2("blabla",10,10); but it still wont wor, but i dont have any errors now






so do u mean i should make like:
PHP Code:
function onCreated() {
//blabla
  
Warp000();
}
function 
Warp000() {
//or function onWarp000() { i have seen this two what should i use
//blabla

No, not at all.

I mean like:

PHP Code:
function warpPlayer(levelxychatText)
{
  
setlevel2(levelxy);
  
player.dir 2;
  
  if (
chatText != null)
    
player.chat chatText;
  else
    
player.chat "Warped";

This way, if you wanted to change the direction for all warps, you would only need to change it in one place, saving you time and money (you pay for gold right?).

And onSomething is generally used for events rather than bog-standard function yet I've them being used as if there is no distinction.
Reply With Quote
  #7  
Old 01-09-2011, 07:16 PM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
I don't care about == or =

it works fine so what is the problem.
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #8  
Old 01-09-2011, 07:21 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by PowerProNL View Post
I don't care about == or =

it works fine so what is the problem.
Please stop scripting.

An example of when it's a problem:

PHP Code:
function onCreated() {
  if (
wasBar()) {
    
// this shouldn't be called, but is!
    
echo("damn");
  }
}

function 
wasBar() {
  
temp.foo "foo";
  return (
foo "bar");

__________________
Reply With Quote
  #9  
Old 01-09-2011, 07:29 PM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
Quote:
Originally Posted by cbk1994 View Post
Please stop scripting.
no? why would I?
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #10  
Old 01-09-2011, 07:31 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by PowerProNL View Post
no? why would I?
Because you have no idea what you're doing.
__________________
Quote:
Reply With Quote
  #11  
Old 01-09-2011, 07:41 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by fowlplay4 View Post
Because you have no idea what you're doing.
This.
__________________
Reply With Quote
  #12  
Old 01-09-2011, 09:15 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
He shouldn't stop scripting. He should learn from this and try to improve. He should definitely stop giving out completely wrong advice though.
Reply With Quote
  #13  
Old 01-09-2011, 10:20 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
Quote:
Originally Posted by Codein View Post
He shouldn't stop scripting. He should learn from this and try to improve. He should definitely stop giving out completely wrong advice though.
Quote:
Originally Posted by PowerProNL View Post
I don't care about == or =

it works fine so what is the problem.
if that's his attitude about scripting, then he should.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #14  
Old 01-09-2011, 11:25 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by PowerProNL View Post
I don't care about == or =

it works fine so what is the problem.
Because in the future when you post about a script not working, we are going to laugh at you, and then link you back to this very post and ridicule your terrible attitude towards scripting. Maybe then you will wish you had listened to the advice of people who know more about GScript than you do. We do not have time for people who "don't care", and we do not want people who "don't care" posting in this forum.
__________________
Skyld
Reply With Quote
  #15  
Old 01-09-2011, 11:26 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
When I first started I made the most retarded posts in the NPC forum. (Thinking as though I was a scripter... hehe)

I suppose I learned from it though, and you will too. Don't give up
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:27 PM.


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