More Than One script Import Problems

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Goggle
Slime
Posts: 6
Joined: Thu Jul 30, 2015 11:39 am
Location: Somewhere on this planet called "Earth"

More Than One script Import Problems

Post by Goggle »

I'm trying to get multiple scripts into my game.
I've read that you just put all your scripts into one file, but I always get an error message whenever I try to import the scripts file.

This is my current script file:

Code: Select all

include, plotscr.hsd
include, [Game name here].hsi

#----------------------------------------
#Allows you to run with Z

plotscript, on keypress handler, begin
  if(hero is walking(me) == false) then(
    set hero speed(me, 4)
    if(key is pressed(key:Z)) then(
      set hero speed(me, 10)
    )
  )
end

#----------------------------------------
#Teleports you to Ban Haven

plotscript, simple item teleport, begin
  fade screen out
  teleport to map (map:Ban Haven,11,4)
  wait (1)
  fade screen in
end
Whenever I try to import it, I get the following message:

Code: Select all

ERROR: in script onkeypresshandler on line 10 in MQ.txt
if(key is pressed(key:Z)) then(

Unrecognised name key:z. It has not been defined as script, constant,
variable, or anything else
What's weird (and frustrating) is that whenever I try to import only one of these it works perfectly.
So I'm not sure what I'm doing wrong.

Thanks in advance.
Last edited by Goggle on Fri Aug 07, 2015 10:59 am, edited 1 time in total.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

That error message means it does not understand key:z

The key: constants are defined in a different file. You should add:

Code: Select all

include, scancode.hsi
User avatar
Goggle
Slime
Posts: 6
Joined: Thu Jul 30, 2015 11:39 am
Location: Somewhere on this planet called "Earth"

Post by Goggle »

I see.

So, instead of key:z I should make it key:44?


Also, if I add

Code: Select all

include, scancode.hsi
where do I add it then exactly? Do I add it under

Code: Select all

include, plotscr.hsd
include, [Game name here].hsi 
or somewhere else?

EDIT: Never mind. Figured it out!
Thank you!
Last edited by Goggle on Fri Aug 07, 2015 12:23 pm, edited 1 time in total.
Post Reply