Jump to content

Photo

Basic Zscript Question

basic zscript question script programming

  • Please log in to reply
4 replies to this topic

#1 linkinsphere

linkinsphere

    Junior

  • Members
  • Location:US

Posted 05 September 2013 - 12:06 PM

Hello, I'm beginning to learn how to program in Script, but the first language I've learned was Lua.
So I'm actually used to commands such as (let's say I want to make a counter for cheats upon every 5 deaths):

Lua:
while true do
local int deaths = 0;
local x = game.Player;
if x.HP == 0 then
deaths = deaths + 1
if deaths == 10 then
local cheat;
cheat = cheat + 1
if cheat > 4 then
cheat = 4;
return end
end
end
end
wait(.1)
end

ZScript (a lot more complicated to me):
import "std.zh"
global script death_count
(I don't remember how it goes from here but, it's all mathematical algorithm which I just don't get completely; the entire algorithm (not the math))

Why is this so complicated? And how can I simplify all these algorithms for myself?

#2 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 05 September 2013 - 12:19 PM

Ok first, you don't even need to count deaths:

	/**
	* The number of times Link has perished during this quest.
	*/
	int NumDeaths;

ZScript already does that :)

 

I'd suggest looking at other peoples scripts to see how they are written. Look at scripts from the script database for example.


  • linkinsphere likes this

#3 jsm116

jsm116

    Script kludger

  • Members
  • Location:The 301

Posted 05 September 2013 - 12:38 PM

I learned to program in another language first, and the tutorials that Saffith wrote were invaluable. Do them, step by step, don't skip around, and you'll get the structure of the language pretty well. http://www.purezc.ne...showtopic=53370

 

Also, spend time browsing around the ZCWiki

 

http://www.shardstor...Cwiki/Main_Page

 

That should give you a great start. Welcome to PureZC!



#4 linkinsphere

linkinsphere

    Junior

  • Members
  • Location:US

Posted 05 September 2013 - 12:44 PM

Ok first, you don't even need to count deaths:

/**
	* The number of times Link has perished during this quest.
	*/
	int NumDeaths;
ZScript already does that :)
 
I'd suggest looking at other peoples scripts to see how they are written. Look at scripts from the script database for example.

Alright, thanks! Btw, I 'liked' your comment :)

#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 05 September 2013 - 06:46 PM

Do you want a functional lives system? I have nearly finished one, and am in the play-testing phase if you want a complete package; you could use it, and for example, give the player X-items if they run out of lives and need to continue. (I intend to do quite the reverse, but it seems that you want a difficulty mode more than anything else.)

I didn't know that you could set cheat modes from within ZScript: That could make for some bizarre items.



Also tagged with one or more of these keywords: basic, zscript, question, script, programming

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users