Hey,
Got bored a bit, and don't know what to add to the scripts I made a while back. so having you guys give me an opinion would help. Also, I'm still at a learning stage to any developer feel free to correct me/teach me anything new or give me idea's or other ways to do the certain thing. Echo from NC (Made while learning triggerserver)
Current usage by saying "/echo TextGoesHere"
Can echo from the player's chat to RC
Anti-Spam built (yes, I know timevar2 but I have thought of a different way)
function Calculator_equ.onAction() { if (Calculator_Tb1.text == "" || Calculator_Tb2.text == "") { return; } if (this.mode == "+") { Calculator_Result.text = Calculator_Tb1.text + Calculator_Tb2.text; } if (this.mode == "-") { Calculator_Result.text = Calculator_Tb1.text - Calculator_Tb2.text; } if (this.mode == "X") { Calculator_Result.text = Calculator_Tb1.text * Calculator_Tb2.text; } if (this.mode == "/") { Calculator_Result.text = Calculator_Tb1.text / Calculator_Tb2.text; } }
-------------------------------------------------
Any errors? Please tell me so I can learn. I'd Like to Thank Emera and Callimuc for all the effort they put into teaching me those. Can't thank you enough guys :)
Bulldogg Lucero
08-18-2012 05:54 PM
Man thats bad to many Errors you should throw it away man you'll never make it
Nah jk, i'm reall not that good with scipts
But does it work on Offline Editor? xD
Johnaudi
08-18-2012 06:00 PM
Quote:
Posted by Bulldogg Lucero
(Post 182315)
But does it work on Offline Editor? xD
It's Gs2, Offline Editor uses Gs1.
Bulldogg Lucero
08-18-2012 06:03 PM
Oh, well they should upgrade that :\
Emera
08-18-2012 07:44 PM
Quote:
Posted by Johnaudi
(Post 182303)
Hey,
Got bored a bit, and don't know what to add to the scripts I made a while back. so having you guys give me an opinion would help. Also, I'm still at a learning stage to any developer feel free to correct me/teach me anything new or give me idea's or other ways to do the certain thing. Echo from NC (Made while learning triggerserver)
Current usage by saying "/echo TextGoesHere"
Can echo from the player's chat to RC
Anti-Spam built (yes, I know timevar2 but I have thought of a different way)
function Calculator_equ.onAction() {
if (Calculator_Tb1.text == "" || Calculator_Tb2.text == "") {
return;
}
if (this.mode == "+") {
Calculator_Result.text = Calculator_Tb1.text + Calculator_Tb2.text;
}
if (this.mode == "-") {
Calculator_Result.text = Calculator_Tb1.text - Calculator_Tb2.text;
}
if (this.mode == "X") {
Calculator_Result.text = Calculator_Tb1.text * Calculator_Tb2.text;
}
if (this.mode == "/") {
Calculator_Result.text = Calculator_Tb1.text / Calculator_Tb2.text;
}
}
-------------------------------------------------
Any errors? Please tell me so I can learn. I'd Like to Thank Emera and Callimuc for all the effort they put into teaching me those. Can't thank you enough guys :)
I can't nitpick right now since I'm on my iPad and I'm not up for scripting on it, but you've learned a crapload :) good job man.
callimuc
08-18-2012 07:55 PM
Hate to complain but meh its better i gues :P
1. Yes you didnt use timevar2 on purpose but its way easier
Spoiler
PHP Code:
function onActionServerSide() { if (params[0] == "echo") { temp.toks = player.chat.substring(6); if (this.lastused+5 < timevar2) { echo(player.nick @ " [" @ player.account @ "] : " @ this.toks); player.chat = "Echo'd: "@temp.toks; } else player.chat = "Please wait 5 seconds before sending an echo again"; } }
//#CLIENTSIDE function onPlayerChats() { if (player.chat.starts("/echo")) triggerserver("gui", name, "echo", player.chat.substring(6)); }
2. too lazy to rewrite it but you should always warp the player on serverside
3. didnt check the whole thing but seems kinda messy for me too :(
in all its pretty good but there is some stuff you should improve on like serverside checks and so on
Johnaudi
08-18-2012 08:56 PM
Quote:
Posted by Emera
(Post 182351)
I can't nitpick right now since I'm on my iPad and I'm not up for scripting on it, but you've learned a crapload :) good job man.
crap? .-. Lol Ty :3
Quote:
Posted by callimuc
(Post 182356)
Hate to complain but meh its better i gues :P
1. Yes you didnt use timevar2 on purpose but its way easier
Spoiler
PHP Code:
function onActionServerSide() { if (params[0] == "echo") { temp.toks = player.chat.substring(6); if (this.lastused+5 < timevar2) { echo(player.nick @ " [" @ player.account @ "] : " @ this.toks); player.chat = "Echo'd: "@temp.toks; } else player.chat = "Please wait 5 seconds before sending an echo again"; } }
//#CLIENTSIDE function onPlayerChats() { if (player.chat.starts("/echo")) triggerserver("gui", name, "echo", player.chat.substring(6)); }
2. too lazy to rewrite it but you should always warp the player on serverside
3. didnt check the whole thing but seems kinda messy for me too :(
in all its pretty good but there is some stuff you should improve on like serverside checks and so on
@1) Ty, I'll try to use it next time.
@2) even the player.x and y?
@3) what's so messy .-.
And thanks, I'll try to redo some new ones tomorrow, can anyone give me an idea?
callimuc
08-18-2012 10:50 PM
Quote:
Posted by Johnaudi
(Post 182377)
@2) even the player.x and y?
would just use setlevel
Quote:
Posted by Johnaudi
(Post 182377)
@3) what's so messy .-.
some stuff which could probably be written better
also are you sure your n0-9 stuff is saved in the whole script?
Zdog
08-19-2012 03:18 AM
I still need scripters for my game did you view my thread?
callimuc
08-19-2012 03:46 AM
GS1/2 is not the same as java/python/...
Johnaudi
08-19-2012 07:13 AM
Quote:
Posted by callimuc
(Post 182438)
would just use setlevel
some stuff which could probably be written better
also are you sure your n0-9 stuff is saved in the whole script?
Oh yeah, it's on the creation point, it gives the value to the Button, check down a bit. Example :
Created() n1.value = 1;
Button n1() textbox1.text = textbox1.text @ n1.value
Check the parts down and you'll understand. The calculator is working, it's just the parentheses () which have no functions.
Quote:
Posted by callimuc
(Post 182601)
GS1/2 is not the same as java/python/...
Gs1 is similar to java tho.
topsamman
08-19-2012 07:19 AM
Quote:
Posted by Bulldogg Lucero
(Post 182318)
Oh, well they should upgrade that :\
Wow...
Emera
08-20-2012 03:06 PM
Right, I'm back home. You've over complicated the echo message with the timeout and what not. You'll be better off using an echo like Callimuc said. Here's what I've come up with.
PHP Code:
const WAIT_TIME = 5;
function onActionServerside() { switch(params[0]) { case "echoMessage": { if (clientr.msg_wait >= timevar2) { player.chat = "I must wait" SPC WAIT_TIME SPC "seconds!"; } else { echo(player.nick SPC "(" @ player.account @ "):" SPC params[1]); clentr.msg_wait = timevar2 + WAIT_TIME; } break; } } }
//#CLIENTSIDE
function onPlayerChats() { if (player.chat.starts("/echo")) { temp.msg = player.chat.substring(6); triggerServer("gui", "name", "echoMessage", temp.msg); } }
callimuc
08-20-2012 03:34 PM
Quote:
Posted by Emera
(Post 183195)
PHP Code:
clentr.msg_wait = timevar2 + WAIT_TIME;
:unsure:
Johnaudi
08-20-2012 03:47 PM
This would be easier? : (this.stoptime + 5 < timevar2) {}
Would it work? :p